Elizabethan Ghost-lore

That there happen straunge wonders and prognostications, and that sodeyn noises and cracks and suchlike, are hearde before the death of men, before battaile, and before some notable alterations and chaunges. It happeneth many times, that when men lye sicke of some deadly disease, there is some thing heard going on their chamber, like as the sicke man were wonte, when they were in good health: yea & the sicke parties them selues, do many times hear the same, and by and by gess what wil come to passe. Oftentimes a litle before they yield vp the ghost, and some time a little after their death, or a good while after, either their owne shapes, or some other shaddowes of men, are apparantly seene. And diuers times it commeth to passe, that when some of our acquaintaunce or friends lye a dying, albeit they are some many miles off, yet there are some great stirrings or noises heard. sometimes we thinke the house will fall on our heads, or that some massie and waightie thing falleth downe throughout all the house, rendering and making a disordered noise: and shortlie within fewe months after, we vnderstande that those things happened, the verysame houre that our friends departed in. There be some men, of whose stocke none doth dye, but that obserue and marke some signes and tokens going before: as that they heare the dores and windowes open and shut, that some thing runneth vp the staires, or walketh vp and downe the house, or doth some one or other such like thing.
  -- Lewes Lavater, Of Ghostes and Spirites Walking by Nyght, 1572, University Press, Oxford, 1929,, I. xvii, p.77-78.

The very existence of texts like the one above attests to the popularity of the subject of ghosts in Elizabethan and Jacobean England.  These were not the ravings of oddball fanatics or religious cults. They were as mainstream as possible. In fact, James I, the king of England was the author of one such scholarly text about ghosts. Furthermore, learned studies about ghosts,spirits and apparitions were directed toward an educated audience, and approach their topic from the perspective of science, religion, and psychology. Effectively, the topic was treated with reverence and respect.

At the same time, ghost-lore is not reserved for the educated classes in Elizabethan England, and we find throughout Shakespeare's work extraordinary bits of information coming from the mouths of common people. John Dover Wilson talks of the considerable popularity of the topic in his introduction to the Lavater treatise. He considers it only natural that walking spirits should have a place on the popular stage.

Elizabethan drama and poetry generally is saturated with the demonology and ghost-lore of the time, which is only natural seeing that, in Le Loyer's words, "of all the common and familiar subjects of conversation that are entered upon in company, of things remote from nature and cut off from the senses, there is none so ready to hand, none so usual, as that of Spirits, and whether what is said of them is true. It is the topic that people most readily discuss and on which they linger the longest because of the abundance of examples, the subject being fine and pleasing and the discussion the least tedious that can be found."
  - John Dover Wilson, Introduction to Lavater, pp. ix-x.

Shakespeare wrote Hamlet at a time when a very considerable debate raged in England about the nature of ghosts. If one is aware of the issues and the positions that separated Protestant reformers from Catholic conservatives, and even the issues that divided the reform wing, one can see the national debate mirrored in the play. Thomas Alfred Spalding alludes to those issues in his writing, but at the base of the topic is the mutually shared conviction that spirits and apparitions not only exist, but that they also penetrate daily life.

I intend, therefore, to attempt to sketch out the leading features of a phase of religious belief that acquired peculiar distinctness and prominence during Shakespeare's lifetime -- more, perhaps, than it ever did before, or has done since -- the belief in the existence of evil spirits, and their influence upon and dealings with mankind. ... There were two opposite schools of belief in this matter of the supposed spirits of the departed: - the conservative, which held to the old doctrine of ghosts; and the reforming, which denied the possibility of ghosts, and held to the spirit of devils.
   -- Thomas Alfred Spalding, Elizabethan Demonology, p.11.