For most people all Halloween means is putting on costumes, then going trick-or-treating, followed by a long session of gorging on sweets before passing out in a pile of sticky wrappers. Some religious people still associate this holiday with evil spirits or other superstitions like ghosts.
The real reason why Halloween is held each year on the 31st of October is because this was the last day of the Celtic calendar, and a pagan holiday for honoring the dead. This was known as the feast of Samhain. This was a harvest festival to signify the end of summer. Originally the holiday was celebrated with huge feasts and bonfires, a way to mark the ending of one year and the beginning of the next.
For a long time it was believed that Samhain was actually a deity that the Celts worshipped. But the literary or archaeological evidence to back this up has never been found. Almost all of the customs connected with this day are, and were throughout history, just remnants of other ancient rituals of the Druids and then of the Roman Catholics that conquered them.
Back then, "Halloween" festivities included rituals that were thought to predict someone's future. Like when they would marry, when they would bear children, and how many. The flames, smoke and ashes from the bonfire rituals were believed to have both protective and cleansing powers, and as the years passed and Christianity influenced Halloween, these bonfires then also served to keep the devil away.
The name Halloween is derived from All Hallows Eve. The day before All Saints Day which is celebrated on November 1st, a day that Christians used to convert pagans on, and is still celebrated by them, to this day. This day was meant to replace Samhain, and in many ways it did, with all the traditions and customs of the Celts dying out.
Celts believed that on Halloween the spirits of the dead got to roam the streets for just one night, and because some spirits were believed to be evil, they would leave gifts and treats out to win their favor and thus ensure that the following year's crops would be plentiful. This is how trick-or-treating first came about. But it was not until the 16th century that wearing costumes became a part of it.
People began visiting each others houses dressed in a disguise, reciting poems in exchange for food. They would impersonate these spirits of the dead, and receive offerings on their behalf, believing that this would then protect you from them. This was originally known as mumming or guising. After the mass immigration to North America in the 19th century Halloween became popularized and further transformed into how Halloween is celebrated around the world today.