When there is something in the area that is cloaked, the cloak detector will begin to flash. The more rapidly it flashes, the closer the cloaked object is. This is a crude, but reliable way to detect a cloak; however there are cloak detecting sub systems. You can also turn the tables on your enemies and install cloaking devices on your own ships instead of shields. Keep an eye out for these components for sale at space stations.