The people who lived in England during Shakespeare's time knew of ghost's mostly through religion. During the 16th century there were two major religions in England, one of them being Catholicism. The other running across Europe into England was the Protestant religion. The two had similar beliefs when it came to ghosts but differed in the area of where they came from. The fear that came from the beliefs of Catholics held sway over most yet the way that Protestants believed that sightings of ghosts had logical explanations were believed by many. Shakespeare used that fear of ghosts from Catholicism as well as the laughable way that Protestant's looked at ghosts to support the tragedy of Hamlet through the ghost of his father.
Before the fourteenth century, ghosts were thought of as unimportant and without power. The only use they had was when they were called upon to assist the living with information or advice.
They could not do any harm at all because they really had no power in that day. They were merely memories of the dead kept alive by those who remembered them. Right after this era, men became more interested in art, history and politics as well as becoming more interested in themselves internally. During this time in the rise of great societies and learning, ghosts began to "manifest" themselves in a more active way. Instead of being passive, ghosts became insistent on getting humans to do what they wanted. These apparitions suddenly took on evil attributes, but they could still help humans occasionally.
So people were more interested in the inner working of themselves and the evils they were committing, essentially becoming more interested in their own souls. Concerning themselves with the afterlife and the fear that what they had done here on earth...