Halloween remains an incredibly popular holiday and tradition in America mainly because it is so heavily associated with American entertainment, popular culture and customs. This is ironic as Halloweens origins are truly based more in ancient European origins and pagan traditions.
The ancient Celtics marked October 31st as the last day of the summer (dubbed Samhain). The Catholic tradition marked November 1st as All Saints Day, so the evening before was All Hallows Eve which had become corrupted into Halloween.
Now, the Celts and the Druids felt that on October 31st, the dead would rise and their spirits would wander the earth. Sometimes they would play tricks on people and sometimes they would kidnap, devour or pull the living down into hell.
So, humans decided the best way to save themselves would be to dress up in costumes so as to appear as if they were the dead spirits themselves. In that regard, the dead would not recognize the humans and be fooled enough so as to avoid capturing them.
Over the years, numerous other traditions would become absorbed into Halloween. As the Roman empire conquered the druid lands, the game of bobbing for apples became associated with the druids, Celts and Halloween. This is because they borrowed the Roman honoring of the harvest God and made a ritual of their own out of it.
Witches would be amalgamated from Irish tradition as would Jack OLanterns. Eventually, all the traditions of Halloween would find themselves lumped together in one big melting pot of traditions. Also added into this tradition would be trick or treating.
In more standard terms, trick or treating is a form of begging. The origins of it derive from beggars going door to door asking for soul cakes that would help save their soul from damnation or kidnapping from demons that walked the earth. It was a great scam and gimmick and the popularity of which caught on. Eventually, it became amalgamated into Halloween traditions with everything else and eventually became the tradition most associated with Halloween. And with good reason, trick or treating is really a cool form of getting something for doing absolutely nothing!
Over the years, the origins of Halloween have been forgotten. In some cases, the origins were never known to begin with! Considering that the concept of pagan religions that routinely participated in human sacrifices provide the inspiration for a kids holiday may end up chipping away at its popularity, it would seem that Halloween ending up becoming more associated with horror book and movies. While some may consider horror films unsavory, they are ultimately harmless escapist entertainment that really doesnt make people uneasy in the same way the celebration of violent pagan earthen religions would. So, the Celtic/Druid angle was dropped down a black hole. One wonders what that Charlie Brown Halloween special would have looked like if the concept of human sacrifice was mentioned in it? Ok, that is too bizarre of a thought to ponder. But fun to ponder nonetheless.