Bioluminescence has many functions and it frequently serves multiple roles in the same organism.
(1) Attracting prey: Bioluminescent glow is thought to be an attraction signal. For example, the octopus Stauroteuthis uses its luminous suckers to attract plankton. An anglerfish also attracts prey in a similar manner by using bacteria to produce a kind of glowing lure. A certain type of squid has special light organs which also serve as lures that dangle at the end of long tentacles, like fishing lines.
Some non-luminous predators actively use bioluminescence in their environment to attract or reveal their prey. Elephant seals dive to great depths and feed on fish and squid there.
(2) Escaping from predators: As opposed to glowing, sudden flashes of bioluminescence are thought to act as repellants. Bioluminescence can startle predators, causing them to hesitate in their attack. The bioluminescent display may also serve as a smoke screen—a cloud of sparks or glowing fluid that makes it difficult for the predator to track the location of its escaping prey. Examples of this type of bioluminescent behavior can be found in shrimp and vampire squids. Every species of firefly has larvae that glow to repel predators.
Bioluminescence can also serve as an indication of toxicity or unpalatability. Some plankton in particular have an interesting twist on this mechanism. When a predator of plankton is sensed through motion in the water, the plankton luminesces. This in turn attracts even larger predators which consume the would-be predator of the plankton.
(3) Inter-species communication: Communication within species is a well-known function of bioluminescence, and is mainly used for reproduction-related activities. A good example is fireflies using their light in courtship. To avoid confusion between members of different types of fireflies, the signals of each species are coded in a unique temporal sequence of flashing. This type of bioluminescent communication is not very common in the sea.
(4) Illumination: Bioluminescence can also be used to illuminate or to induce fluorescence in prey. Some dragonfishes are thought to use bioluminescence to aid in visual searching of prey. For example, the Black Dragonfish produces a red glow. This adaptation allows the fish to see red-pigmented prey which are normally invisible in the deep ocean environment.
(5) Camouflage or counter-illumination: In the depths of the ocean, it’s much harder to see anything below you than to see the silhouette of what's above. For this reason, some species produce spots of light on their undersides (through ventral photophores), which blur their outlines and allow them to blend in with the light from above. This is known as counter-illumination and is well documented in certain types of crustaceans, cephalopods and fishes. The cookie-cutter shark has one unlit patch on its underside which resembles a smaller fish when viewed from below. When a large predator approaches, the shark can take a large bite and then flee. This allows the cookie-cutter shark to prey on animals that are much larger and more powerful than it is.