Today is Halloween so I thought I'd look at the tradition from a linguistic point of view. Halloween is sometimes spelt Hallowe'en, the apostrophe standing for a missing 'v', where 'even' means 'eve'. It's a shortened form of All-Hallow-Even, and can also be called the Eve of All Hallows. Hallow means holy person or saint.
31 October was an important date in pre-Christian Celtic culture as it was the end of the harvest and the end of the year. The festival celebrated on the date was known as Samhain ('mh' is pronounced 'w') and the Celts believed that the souls of the dead came back to visit their old homes and families on that night.
In the 9th century the Christian Church transformed the old pagan festival, which honoured all dead, to a festival honouring only the blessed or hallowed dead. 1 November, the start of the new year, was known as All Hallows' Day, Hallowday or All-hallomas. Shakespeare has Allhallowmas. The Church introduced the alternative name All Saints' Day to cement the Christian connection.
Today's Halloween traditions owe more to Hollywood and the marketing industry than to Celtic culture. Here in the UK we complain about the americanisation of Halloween, but it was Irish immigrants who took the festival of Halloween to the United States in the first place. In Ireland they used to carve out turnips and put a candle inside in memory of 'Stingy Jack' a drunken old farmer who tricked the devil and was then condemned to wander the earth for the rest of his days accompanied by a single candle. Pumpkins were more readily available in North America so Jack-o'-lanterns are these days more likely to be carved out of pumpkins.
The expression 'trick or treating' goes back only to the 1930s (in the US, that is - it's more recent in the UK; the OED's first British citation is 1982). The activity itself goes back much further - to the old practice of 'souling' where people would go from door to door to solicit specially baked 'soul-cakes'. This activity continued into the early 20th century in parts of northern England and in Scotland, where it is known as guising.