A cloaking device is a form of stealth technology that uses selective bending of light (and other forms of energy) to render a starship or other object completely invisible to the electromagnetic spectrum and most sensors. It has been encountered in varying forms over the centuries.
The purpose of cloak is to obscure visual identification. Later versions of the cloaking device have been able to cloak vessels from all but the most advanced scanners and tracking systems. Cloaking devices have been usually used for stealth and its combat uses are limited usually to ambush tactics. For example the early cloaking device was a perfect supplement to the Romulan plasma weapon allowing the Bird of Prey to approach as close as possible to deploy the limited range weapon for maximum effectiveness.
The early development cloaks available were solely the propietary technology of the Romulans. In the first recorded instance of militarty use of a cloakign device against a Starfleet vessel the Romulan cloaking device was completely invisible to visible light and standard optical scanners however she could still register on motion sensors and was tracked in this manner by the Enterprise throughout the engagement near the neutral zone. However this form of tracking proved inefficient in terms of targeting and precision movement, forcing Kirk to lay down a pattern of blind torpedo fire in a similar manner that surface vessels used depth charges against submarines. ("Balance of Terror")
Later on as part of an ongoing technology sharing program Klingons gained the cloaking device and Romulans abandoned the current warbird design in favor of Klingon vessels like the D-7 ("Enterprise Incident") Klingons were using cloaking devices on their own Bird of Prey designs as seen in the Genesis incident when Kruge's Bird of Prey penetrated deep into Federation space destroying the USS Grissom and ambushing the Enterprise utilizing the cloaking device. (Star Trek III: Search for Spock") It is interesting to note that the Klingon cloaking device was visible to normal vision at some distances especially when in motion, leading to speculation that such an obviously inferior cloak to the one the Romulans were using nearly 20 years earlier indicated either a malfunctioning cloak or perhaps this was a first generation cloaking device of Klingon design and manufacture since the technology sharing treaty with the Romulans was presumably over by this point in time.
As seen in TNG era and onward the cloaking devices available to the Klingons and Romulans have grown much more sophisticated. Klingons cloaks were so sophisticated that even when cloaking and decloaking within several kilometers of Deep Space Nine the sensor suites could not accurately track the Klingon vessels. ("Way of the Warrior") Romulan Warbirds were also able to approach the station completely unseen and decloak within several kilometers despite the station being at battle stations, a Klingon fleet and Federation vessels all within range and expecting a Dominion attack. ("By Inferno's Light")
One of the most recent evolutions of the Cloak's design was seen twice, once by Klingon design and another by the Romulans. General Chang of the Klingon Empire utilized a Bird of Prey that could fire while cloaked, a notorious Achilles heel of the standard cloaking device. This Bird of Prey was destroyed over Khitomer and was the only functioning proto-type. We have never seen a Klingon cloaked ship accomplish this again. The cloaking device used on the Scimitar also allowed the vessel to fire cloaked and was used with devastating effectiveness against the Enterprise-E. This would be the natural progression of the device should greater enhancements be made in the future.
The Federation is banned from developing cloaking devices in the Treaty of Algeron with the Romulan Empire. How this could have been imposed on the Federation and why the Federation has hamstrung itself by not developing this technology is amazing and practically unbelievable. Also the Federation did produce one illegal cloaking device - one that is a quantum leap ahead of anything produced by either the Romulans or the Klingons - a phase cloak that allows a vessel to pass through solid matter.
In general, depending on their power sources, cloaked vessels are not shielded. Cloaking and decloaking generally creates a window of vulnerability, exploited by Riker in Generations to destroy a Bird of Prey.
The initial cloaking device was shown as extremely power intensive and nearly drained the power reserves of the Bird of Prey during its battle with the Enterprise in "Balance of Terror". One can speculate that the primary reason a cloaked vessel cannot fire while cloaked may be because too much power is tied into maintaining the cloak to properly power the weapons systems. This is hinted at when Captain Kruge warns the gunner to transfer power to the weapons "At my command." perhaps concerned power would be transfered too soon thus compromising the cloak. ("Star Trek III: Search for Spock")
Romulan officers do not consider the cloak sufficient to bypass prepared defenses (TNG Face of the Enemy).
The cloaking device can be pierced using some sort of Tachyon net.
The Scimitar in Nemesis was shielded during cloak. Worf was eventually able to target the Scimitar based on weapons fire and disable its cloak.
In certain rare instances cloaked vessels can be spotted by the naked eye such as in The Search for Spock, or the external visuals in Nemesis.