Most of the year pumpkins are hard to find but on Halloween they're everywhere. Why do we carve them and why are they called jack-o-lanterns?
The answers combine swamp gas, a holy day and a New World squash.
Swamp gas: At night in the peat bogs there's an ephemeral light caused by the oxidation of swamp gases phosphine, diphosphane, and methane. Called will-o'-the-wisp (William of the Wisp) or jack-o'-lantern (Jack of the Lantern) it was thought to be the light of a trickster who lured people to follow him into the swamp. The flickering light would go out and those following would be lost.
A Holy Day: In the 9th century the Roman Church moved All Saints' Day (also called All Hallows' Day) to November 1 as the day to remember and pray for the dead. This happens to coincide with the Celtic holiday of Samhain (sunset October 31 to sunset November 1) a harvest festival with visits from the souls of the dead and propitiation of malevolent ghosts and spirits.
Samhain celebrations included costumes and pranks. At night the pranksters carried lanterns carved from turnips called jack-o'-lanterns, named for the spooky lights in the swamp. Here's a turnip jack-o'-lantern. Scary looking!
Since All Hallows' Day celebrates the dead at the same time as Samhain, Samhain traditions became part of All Hallows' Eve (Hallow'een).
A New World squash: Europeans brought Halloween traditions to North America where they found a New World squash, the pumpkin, that's easier to carve and light than a turnip. Ta dah! The pumpkin became a jack-o'-lantern.
Back in the peat bogs, will-o'-the-wisp is rarely seen anymore. Wikipedia says that may be because the swamps were drained. My hunch is that light pollution also makes will-o'-the-wisp too hard to see.
(photos from Wikimedia Commons. Click on the images to see the original)