How does a firefly produce it’s glow?

The simplest answer would be bioluminescence. But that alone doesn’t explain the mechanism and the rationale of exposing your whereabouts to potential predators at night.

Fireflies are familiar, but few realize that these insects are actually beetles, nocturnal beetles. Most fireflies are winged, which distinguishes them from other luminescent insects of the same family, commonly known as glow worms.
Glow worm.
There are about 2,000 firefly species, thriving in a variety of warm environments, as well as in more temperate regions. Fireflies love moisture and often live in humid regions of Asia and the Americas. In drier areas, they are found around wet or damp areas that retain moisture.
Fireflies have dedicated light organs that are located under their abdomens. The insects take in oxygen and, inside special cells, combine it with a substance called luciferin to produce light with almost no heat. Wow.

Firefly light is usually intermittent, and flashes in patterns that are unique to each species. Each blinking pattern is an optical signal that helps fireflies find potential mates, though we aren’t sure exactly how the insects regulate this process to turn their lights on and off.
Firefly light may also serve as a defense mechanism that flashes a clear warning of the insect’s unappetizing taste. The fact that even larvae are luminescent lends support to this theory. Females deposit their eggs in the ground, which is where larvae develop to adulthood. Underground larvae feed on worms and slugs by injecting them with a numbing fluid. Adults eschew such prey and typically feed on nectar or pollen, though some adults do not eat at all.

Why do fireflies glow?

One reason that fireflies glow is to attract a mate. Males and females of the same species will flash signals back and forth as a way of communicating. Each firefly species has its own particular pattern. For example, the fireflies of one species will fly around in the night sky and dive steeply just as the flash begins and turn upward to make a distinctive J-shaped pattern of light. Female fireflies hang out on a tree branch or in the grass while the males fly around showing off their best flashes. When a female recognizes the flash from a male of the same species, she will answer with her best flash.

Another reason that fireflies glow is to avoid predators. Fireflies are filled with a nasty tasting chemical called lucibufagens, and after a predator gets a mouthful, it quickly learns to associate the firefly’s glow with this bad taste! So not only does the flashing help attract a mate, but it also warns predators to stay away.

Other creatures with bioluminescence.

Other glowing animals would be those eerie-looking deep sea dwellers; angler fish, and certain species of shrimp and plankton.
Angler fish. Image: