Several units have the Cloaking ability. While a unit is cloaked, enemies don't see it and can't shot at it. A cloaked unit is revealed when firing or by tachyon effects (see below).
When a cloaked ship fires its weapons, it decloaks itself for around 8 seconds after its last fired shot. In order to prevent ships from auto-attacking and revealing themselves, they can be put into Low Power mode. This is done by clicking the lower-left "Low Power" button or pressing the K key. That state can be reversed by the same mean to allow ships to exit cloak and attack.
While cloaked, ships are immune to damage and tractor beams, but not to Mines and Area-of-Effect damage.
Several units have the "Tachyon Beam Emission" ability, associated with a range. This ability allows a unit to reveal cloaked units around it within the specified range. When a cloaked ship is tagged by a tachyon beam emitter, it becomes decloaked for around 15 seconds.
Few fleet ships have that ability, notably the Tachyon Microfighter and the Sentinel Frigate. Human players have access to the Scout Starship, the Tachyon Drone, the Decloaker and a pair of Tachyon Turrets (the advanced one also have cloaking). AI players post Tachyon Sentinels at every wormhole in their territory.
There is a few other sources of tachyon. Humans have a Tachyon Warhead with a planetary range. The AI can use planetary Tachyon pulses in response to Hacking. The two AI Homeworlds also have a planetary Tachyon coverage emitted by their special Command Stations.
Scout Drones have the "cloaking booster" ability, which protects one adjacent unit from tachyon effect. When scouts are traveling in groups, some of them will boost the cloaks of the others, which protects the boosted scouts from being revealed by tachyon beam emitters. The scouts doing the boosting cannot themselves be boosted, which means that some of the scouts are likely to be picked off or at least damaged at every tachyon beam emitter that is passed. Higher-level scouts can boost multiple ships at once, and also have a bigger boost range.
In short, this lets some of the scouts in a group provide "perfect" protection to other members of that group, taking all the incoming shots on themselves until they are destroyed (at which time other members of the group start protecting each other). This prevents all scouts from being destroyed at once when passing through highly-defended planets or wormholes.
Only the Cloaker Starship have the "cloaking superbooster" ability. This ability allows nearby units to be cloaked, regardless of their lack of innate cloaking ability. It can be used to launch small cloaked attacks on the AI, or to move around things undetected.
Also, units under a Cloaking SuperBoost are considered cloaking boosted, thus only the Cloaker Starship itself will be tagged by tachyon emitters. They are fragile though, so it is best to bring multiple, or destroy tachyons before attempting this.
The main benefit of cloaking is of course the surprise factor, but it is also an excellent way for ships to slip past otherwise very-difficult defenses. This makes cloaked ships great for deep raids, or gate-raids on planets that are otherwise troublesome. The cloaking of scouts is useful for helping them to slip past enemy defenses.
Cloaking can also be used to cherry-pick battles: cloaked ships can approach enemy units, engage them when at close range, then retreat and recloak before other units can come to help. This way, a small group of powerful cloaked units can take down a bigger fleet, one chunk at a time.
As AI players don't replace the Tachyon Sentinels guarding wormholes, Human players can carve paths for cloaked deep-strikes or deep-scout missions. With a small army of several kinds of cloaked ships, a sentinel-free chunk of AI territory can make movement much more easy, allowing players to efficiently defend Waves on remote planets.
In versions 4.021 and prior, there as a "partially cloaked" state where a lilac halo is all that shows for the ship, so players can't tell what kind of ship it is, but they can still shoot at it. Tachyon beams caused this partial cloaking state instead of the decloaked state, but this was removed because it was overly complex and didn't really accomplish much.