For centuries, Halloween has represented the innermost fears and fantasies of children (and adults). When the Celts occupied Europe (long before the birth of Christianity), late autumn was the time for thanksgiving for bountiful harvests, and for resting from the hard work of farming. All Hallow's Eve was also presented to the people as the night when ghosts, goblins, and other spirits of the netherworld (good and bad) roamed the earth. People lit candles and lanterns and dressed up in animal skins (forerunners of modern costumes) to ward off the spirits of the dead. These spirits were widely believed to masquerade as cats, witches, and ghosts. Over the years, people in costumes began to visit huts/homes and ask for "treats"--those who complied were prayed for to give them a good year; those who refused were warned to watch out for evil spirits (or "tricks").
Specifically, Halloween derives from the Celtic feast day of Samhain (Samain, Sowain). It was the first festival of the Celtic calendar and marked the beginning of the first quarter of the new year. The souls were believed to be about because, according to legend, the wall between the worlds of the living and the dead is thinnest at this time of year and cracks opened up between the two realms (the earth is believed to be closest to "death" at this time of year--all the crops have been harvested, leaves have fallen, and the cold winds moan). The Celts believed that Samhain, a Celtic god known also as the "Prince of Darkness," brought winter (the season of death symbolized by the now "dead' flora as well as by coldness). Samhain called together all the spirits of the dead on October 31st. If a dead person had had a "bad" life, the person would come back as an animal--a really evil person's spirit would take the form of a black cat.
All fires were extinguished to "put out" the old year; indeed, Samhain means "end of summer." Sacrificial victims (usually animals of the fields) were burned in the brand new fire which was lit--a huge roaring bonfire--and all new fires were lit from this burning pyre. (In Lithuania, Halloween was also the New Year's feast and domestic animals were sacrificed to Zemiennik, the lord of the underworld.) Families and individuals danced around the fire and around the resting fields, from east to west, to insure the power of future life and many people carried branches of Fir--the Tree of Life (all evergreens carry this Eternal Life symbolism).
Boys, some of them blowing horns, went from home to home to ask for food and drink to be provided for the festival. Interestingly, girls believed that if they practiced certain rituals at this time, such as looking into a mirror at midnight while brushing their hair three times, that they would see their future husbands. The Irish carried a light or lantern carved from a large turnip (a Jack-o'-lantern predecessor!) on October 31st to ward off evil spirits. As they went from home to home, they invoked the name of Muck Olla, an old Celtic god: "Muck Olla will be good to you if you help us."
Many celebrants wore animal skin costumes and/or the severed heads of animals (appropriately cleaned and dried) to honor the god and to appease him. The costumes were believed to scare away the evil spirits Samhain had called back from the dead for the night.
Following along on the heels of the Celts (still before Christianity), the early Romans celebrated a festival dedicated to the goddess Pomona, with whom the game of bobbing for apples (a pomme) is associated. They also gave nuts to their friends and neighbors. This was celebrated on November 1st. The apple is the sign of the Crone aspect of the goddess, the Hag of Death. To be given an apple is to receive a death wish or a foretelling of one's death. To bob for and catch an apple is a sign of rebirth. The apple is the repository of the soul; the dead were even buried with apples to ensure the safe passage of their souls through the underworld and to rebirth in an afterworld or successful reincarnation on earth. (Other Europeans added different touches: the Italians left bread and water out at night to appease the ghosts; some Europeans left doughnuts and milk for returning spirits; others placed empty chairs in a circle--one for each family member and an extra one for a ghost.)
In the 1800s, Irish (perhaps Scot, as well) immigrants brought the holiday to the United States and it has evolved into a sort of quasi-national celebration: a sort of early Mardi Gras, complete with costumes, parades, candy "handouts," carved pumpkins, bobbing for apples, cider and doughnuts, etc. Unfortunately, some really evil "spirits," in the form of human beings, somewhat derailed the "good honest fun" of Halloween by inserting dangerous objects into the candy which they handed out to children. So, the unabashed enthusiasm with which both adults and children participated in the evening festivities of Trick or Treating has somewhat abated. In addition, some members of various religious denominations have decried the "pagan" roots of Halloween and tried to get it "banned" from public schools, saying that the celebration promotes witchcraft, etc. Many educators now "tie" the fun of Halloween costumes to book report days or "character role playing" days.
Interestingly, the early Christians simply adapted the ceremony (as they did with practically every Druid or Celtic festival) to their new beliefs. An early children's poem/song shows how the two religious ideologies were mingled.
Soul! Soul! For a soul-cake!
I pray you, good missus, a soul cake!
An apple, a pear, a plum or a cherry,
Or any good thing to make us all merry.
One for Peter, Two for Paul,
Three for them that made us all.
Soul, soul for an apple or two,
If you've got no apples, pears will do;
If you've got no pears, ha'pennies will do,
If you've got no ha'pennies, then God bless you.
(Opie and Opie 1959)