Samhain, or "Summer's End", marked the end of the harvest in Celtic tradition; the end of the "lighter half" of the year and beginning of the "darker half". Samhain begins at sunset tonight and continues all day tomorrow until sunset.
It was once believed that the border between this world and The Otherworld became at its thinnest on Samhain, that it opened a portal of opportunity to enter the Otherworld, and for Otherworldly entities to enter our realm. The resultant celebration took on a sort of Festival of the Dead feeling.
The Gaelic festival became associated with the Christian All Saints Day and All Souls Day, and later got woven into the secular customs now connected with Halloween.
Beginning in the Middle Ages, the custom of "Souling" became popular, in which poor people (both children and adults) would go door-to-door begging for food on All Saints Day. Something called "Soul Cakes" were made and distributed to the beggars, each cake eaten supposedly representing a soul being freed from Purgatory. Although some would claim an unbroken line of tradition between Souling and Trick-or-treating, there is actually a considerable gap in the historical record. According to Wikipedia:
Ruth Edna Kelley, in her 1919 history of the holiday, The Book of Hallowe'en, makes no mention of ritual begging in the chapter "Hallowe'en in America." Kelley lived in Lynn, Massachusetts, a town with about 4,500 Irish immigrants, 1,900 English immigrants, and 700 Scottish immigrants in 1920. The thousands of Halloween postcards produced between the turn of the 20th century and the 1920s commonly show children but do not depict trick-or-treating. The editor of a collection of over 3,000 vintage Halloween postcards writes:
"There are cards which mention the custom [of trick-or-treating] or show children in costumes at the doors, but as far as we can tell they were printed later than the 1920s and more than likely even the 1930s. Tricksters of various sorts are shown on the early postcards, but not the means of appeasing them."
The earliest reference to Trick-or-Treating occurs in a 1927 Canadian newspaper article that speaks of it as if it is a brand-new fad theretofore unknown.
Attempting to contact The Spirit World via wooden alphanumeric Ouija Boards was a popular Halloween party diversion during the Victorian Era. The "divination by planchette" phenomena is one that is real and is verified, despite skepticism by the public. This skepticism was exacerbated by the marketing of the board as a child's toy in the mid-20th century. By itself, the board does nothing. It is solely for the guide of the Spiritualist medium to conduct the seance using it and the planchette as a tool.