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.
Cloaking Devices in Star Trek
The purpose of a cloak is to prevent detection before combat and when fleeing combat, and cloaking devices have been able to hide vessels from all but the most advanced scanners and tracking systems. Cloaking devices are usually used for stealth, and their combat use is usually limited to moving into position for an ambush. 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 cloaks were proprietary technology of the Romulans. In the first recorded instance of military use of a cloaking device against a Starfleet vessel, the cloaked Romulan vessel was completely invisible to visible light and targeting scanners, but she could still be detected on motion sensors and was tracked in this manner by the Enterprise throughout the engagement near the Neutral Zone. This form of tracking proved poor for targeting and precision movement, forcing Captain Kirk to lay down a pattern of weapon fire in hopes of catching his target. (TOS, "Balance of Terror")
Later on as part of an ongoing technology-sharing program, the Klingons gained the cloaking device and Romulans abandoned their existing warbird design in favor of Klingon vessels like the D-7 (TOS, "The Enterprise Incident"). Klingons began 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: The Search for Spock)
The performance characteristics of cloaking devices have changed over time. For instance, the Klingon cloaking device in ST3 created a visible distortion effect when the ship was in motion, but it successfully hid the ship from all other forms of detection. As seen in the TNG era and onward, the cloaking devices available to the Klingons and Romulans have grown much more sophisticated. Klingons cloaks are so advanced that even when cloaking and decloaking within several kilometers of Deep Space Nine, the sensor suites could not accurately track the Klingon vessels (DS9, "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. (DS9, "By Inferno's Light")
One of the most recent evolutions of cloaking technology 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 limitation of most cloaking devices. This Bird of Prey was destroyed over Khitomer and was the only known proto-type. We have not seen a cloaked Klingon ship accomplish this since. The cloaking device used on the Scimitar also allowed the vessel to fire while cloaked and was used with devastating effectiveness against the Enterprise-E. This may be the natural progression of the device should greater enhancements be made in the future, but advances in sensor technology may defeat this cloaking system, as apparently occurred with Chang's now-obsolete cloak.
Cloaking Device Politics
The Federation is banned from developing cloaking devices by the Treaty of Algeron with the Romulan Empire. The circumstances under which the Federation agreed to hamstring itself by not developing this technology are unknown. Despite the ban, 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.
Cloaking devices have high power requirements. Consequently, depending on their power sources, cloaked vessels are usually weakly shielded, if shielded at all. Similarly, cloaked ships have relatively little power available for their weapon systems. The initial Romulan cloaking device was so power intensive that it nearly drained the energy reserves of the Romulan Bird of Prey during its battle with the Enterprise in "Balance of Terror". One can speculate that the primary reason a typical cloaked vessel cannot fire while cloaked is that too much power is required for maintaining the cloak to properly power the weapons systems. This is hinted at when Captain Kruge warns his ship's gunner to transfer power to the weapons "at my command," perhaps concerned that power would be transfered too soon, thus compromising the cloak (Star Trek III: The Search for Spock).
Because cloaking devices are integrated into a ship's shield systems, cloaking and decloaking usually creates a window of vulnerability in which shields are not functional; Commander Riker exploited such a weakness in Star Trek: Generations to destroy a Klingon Bird of Prey.
Romulan officers do not consider their cloaking technology sufficient to bypass the prepared defenses at the Federation border (TNG, "Face of the Enemy").
A cloaking device can be defeated using a tachyon net; a cloaked ship trying to pass through the net will still interrupt one of the tachyon beams being transmitted among the ships participating in the net, revealing its location.
In certain rare instances, cloaked vessels have been spotted by the naked eye, such as in Star Trek III: The Search for Spock, or the external visuals in Star Trek: Nemesis.
Cloaking Devices in Star Wars
Cloaking devices have been mentioned a couple of times in the Star Wars movies, but they have only been described in use in post-movie novels.
In Star Wars: The Empire Strikes Back, when the ISD Avenger loses track of the Millennium Falcon, Captain Needa dismisses the possibility that his target engaged a cloaking device because the target ship is too small to have one.
In the Heir to the Empire series of novels by Timothy Zahn, Grand Admiral Thrawn employs cloaking devices in several ways. According to these novels, a ship can avoid detection with a cloaking device, but the cloaked ship is also completely blind, limiting the usefulness of the device.
Cloaking Devices in Stargate
The Goa'uld posses some level of cloaking technology which can be used on both a human scale as well as on the scale of small spacecraft such as Al'kesh and Tel'taks. For the most part Cloaking Devices on the scale of capital ships such as Ha'tak are beyond the technical copacity of the Goa'uld, with the notable exception of that of Sokar's realm. Puddle Jumpers are also equipped with cloaking devices which can be interfaced with Atlantis' shields. In late 2006, Daniel Jackson gave the USAF Odyssey the ability to cloak.