The Lightning Bug is a critter which spawns only in the Hallow biome. It can be damaged by enemies and the player, which usually leads to their death.
Lightning bugs spawn during the night but are rarer than fireflies. They can be caught with a Bug Net to be carried around and released later, put inside a bottle to be used as furniture and light source, or used in crafting a firefly statue. The bottled lightning bug is animated and moves inside, and cannot be released once crafted.
As for fireflies, they may be really useful for fishing due to the large amount that can be caught per night, but in this case the requirements are much higher, reserving them for late game. Indeed they require a farm area with the Hallow, which is only available on Hardmode, and reduced enemy spawn rate. As normally you want to avoid having your main NPChouse overridden by the Hallow, it is advisable to make a farming area on purpose.
The spawn rate of the lightning bugs is randomly determined at the beginning of the night. Therefore on some nights you will see massive swarms and on other nights very few will spawn. Butterflies spawn rates are determined in relatively the same way only the chance for that day is determined at the beginning of the day.
Lightning bugs as well as fireflies spawn at a higher rate on nights during a New Moon.
They may spawn in huge amounts if the two factors above (correct moon phase and high random daily spawn rate) coincide. Literally hundreds of them can then be farmed in the time of a night.
Though it may seem as if the lightning bug is the firefly version of the enchanted nightcrawler (both 35% bait power with similar color changes), they are not crafted like the enchanted nightcrawler.