When you think of Cloaking its best to think of modern plane construction technique, than startreck invisibility cloak.
There are 3 ways by which you can be detected:
* Active sensor work just like radar, they gather info by bouncing radio waves instant gravitational pulses from crafts. Cloaking is a passive method that allow you to reduce the pulse reflection from the craft (thus making it appear smaller), similarly to how those oddly shaped dark Stealth fighters or even modern ships does it.
Presumably ECM allows to actively counter the active pulses by adding noise that will confuse the radar reducing its precision.
* Thermal sensors, allow to lock on your Engine plume, which can be countered by developing various "thermal reduction" techniques.
* Em sensor, allow to lock on energy sources like radar or shields. Once you go active everyone will know where you are.