The availability of a medium is a crucial factor. Vision most often depends on daylight. The Moon at its brightest is 1/10th that of daylight. Some find workarounds.
Fireflies and glowworms manufacture their own light and use it for signaling. Whereas a glow worm may shine from the sheer optimism of being a grub, fireflies put on a serious love light.
In the milky twilight of mild summer nights, a male firefly flashes his wares for females, who are a bit wary. A female responds only to those displays of light that she feels are right.
After a lengthy back-and-forth courtship on the blink, the lights go out. The flashy dating turns into an all-night mating.
The next night, a female is likely to mate again, with a different male; likewise for a beaming male. Fireflies like variety in their couplings for good reason.
A male gives his briefly betrothed a spermatophore: a sperm packet, which the female may later choose to use to impregnate herself. Packet size varies, and size matters. A male with a weighty wad gets the nod to father the next generation.
Mating is not the only reason fireflies alight. A firefly’s glow also warns off bats, which might otherwise eat them. It’s an honest signal. Bats think fireflies have a disgusting taste and will spit them out if they catch one.
Bats don’t depend solely on bioluminescence to avoid an unpalatable snack. Bats can tell fireflies apart from other insects by the speed at which fireflies beat their wings.