Bioluminescence refers to the ability of a living organism to emit light. Most creatures that emit light are sea creatures but some insects and plants also emit light.
All light including bioluminescence is created by the same process. An electron orbiting the nucleus of an atom receives sufficient energy to jump to a higher orbital shell. When it loses energy and falls back to the lower shell the energy it releases escapes in the form of a photon, or particle of light. In most forms of light we are familiar with, like the sun, an incandescent light bulb, or a warm fireplace, the electrons are thermally excited, therefore much energy is released as heat and only a small portion, comparatively speaking, is released as light. However, in bioluminescence the electrons are excited through a chemical process and no energy is lost as heat. Instead, all of the energy escapes as light. Because there is no heat loss bioluminescence is referred to as "cold light."
The chemicals involved in bioluminescence are luciferin, a substrate, and the enzyme, luciferase. Different creatures produce different varieties of these chemicals resulting in different colors of light. The most common color produced by marine life is blue, which is a natural evolutionary selection since blue penetrates farthest through water.
In the ocean, creatures have developed bioluminescence for a variety of reasons. Light can help a fish find food, warn off predators, or attract a mate. Some fish have light organs under their eyes that serve the same purpose as a coal miner's headlamp. Others, like the angler have a bioluminescent lure on the tip of the nose designed not only to attract prey, but a mate. Some shrimp can regurgitate a bioluminescent cloud in the jaws of an attacker to temporarily distract it while the shrimp turns tail and escapes!
Bioluminescence has also evolved to hide the shape or silhouette of a creature against the light blue background of a sun-filtered sea. By shimmering with a bluish color the animal becomes far less noticeable to predators passing above or below it and can more or less blend in with the backdrop of the surrounding water.
On land, certain types of fungus, mushrooms, and worms produce bioluminescence, but the most common is the firefly. Though not all species have this ability, for those who do one behavior is to flash patterns designed to attract a mate. If the female is interested she will flash her own pattern back at a fixed interval after the final flash of the male. A dialog of sorts can take place between them -- their own version of bioluminescent Morse code!
Chemically produced light is also used for glow sticks which when "cracked" combine substances that will glow for up to 24 hours. These sticks are commonly used by divers or night revelers.