The modern holiday of Halloween cannot be traced back to a single-origin, but rather, it has become a combination of various traditions and practices. There are strong Pagan and Christian roots, both of which play their part in the way we celebrate Halloween in modern times.
The location of Halloween on the Christian calendar coincides with the ancient celebrations All Hallows' Eve, All Saints' Day, and All Souls' Day, which occurred October 31st, November 1st, & November 2nd, respectively.
There is also evidence that there are ties to the Feast of Pomona and the Festival of the Dead, called Parentalia from the Romans. But the most common ancient influences are the Celtic festivals Samhain (Samuin), meaning Summer's End. (1)
Trick-or-Treating has its roots based on an ancient Celtic tradition. It was believed that the spirits of the dead would visit the living on this night. To keep these spirits happy and to protect against any mischief, houses were left unlocked and treats were left out to satisfy these departed souls. This was later taken a step further, to living people dressed up as spirits, demanding food from neighbors. (2)