The cloak is no doubt an imperfect device: military hardware usually cannot afford to be laboratory-perfect, even if the "theory of cloaking" allowed for complete masking of all emissions and complete rerouting of all incoming signals such as sensor beams, incidental lighting or bombardment by lightweight particles.
Like
Newtype and
3DMaster say, the device as seen in use
is good enough for its purpose, provided that the correct tactics are used - but can be defeated if the tactics are wrong, even though the mechanisms themselves are extremely seldom shown to malfunction or underperform to the effect of partial let alone total exposure.
No doubt a cloakship wants to allow
some incoming and outgoing emissions, since those are necessary for seeing around. But a useful cloak will be able to let those "information flows" in through very hard-to-spot "windows" (spectral ranges, opportune moments, odd directions etc). And a clever captain will only use his sensors when absolutely necessary; a good computer should be able to interpolate a view of the universe even if the sensors sample the surroundings at ten-second intervals on the average (and irregular intervals at that).
The known vulnerabilities of cloaks have been as follows:
1) The Romulan prototype in "Balance of Terror" was power-hungry, at least when used in connection with that plasma weapon, and thus couldn't be used all the time.
2) Even though giving perfect optical invisibility, said device didn't mask the energy signatures of active maneuvering from Spock's instruments.
3) When moving through a very dense medium, said device failed to mask the resulting compression wave or wake.
Later cloaks do not seem to suffer from any of the above limitations. The following shortcomings are seen in their stead:
4) At point-blank ranges, (some?) Klingon cloakships emit neutrinos that can be detected if one knows where to look (but this is said to be useless in battle).
5) A 2290s-vintage Klingon BoP may leave an impulse exhaust trail, at least when maneuvering carelessly and arrogantly.
Even when a good skipper renders the above two points moot by not getting too close to the enemy, and not leaving a simple, direct impulse trail (or when a clever engineer devises technologies that don't emit neutrinos or leave trails), there are known countermeasures:
6) Tachyons apparently cannot be rerouted as easily as photons or standard sensor beams, so tachyon beams can be used as "tripwires". Tactically it may be very difficult to ensure that the cloaked enemy flies between your two tachyon devices, though.
7) Antiproton beams fired at a cloak also seem to create some sort of a return signal that reveals the cloakship (perhaps the tiny antimatter explosions against the hull cannot be efficiently masked?). But these are only useful at extreme point-blank range, mere ship-lengths away from the looks of it.

Nondescript Dominion sensor tech can detect cloaks across whole sectors, dozens of lightyears away. These sensors only seem to exist in huge planetside mounts, though, and apparently cannot be fitted even on the huge Dominion battleships.
9) Finally, one can always fire blindly, since phaser beams and photon torpedo explosions work just as fine as antiproton beams in giving a "return signal"!
The list of stealth measures in aviation or submarine technology would look very similar, with some "old and solved" problems, some "persisting" ones, and some countermeasures that are ages-old plus some that are hypermodern and often needlessly complicated.
Timo Saloniemi