The genesis of Hamlet's angst is the visitation of his father's ghost, a fact that he refuses to accept at first, which causes him great anxiety tinged with filial guilt. Also represented in the presence of the ghost is the possibility that he is not Hamlet's father at all, but a manifestation of the devil trying to trick Hamlet into taking revenge on those who are suspected of killing the king.
Therefore, Hamlet must consider whether the ghostly image is a temptation designed to allow him to forfeit his own mortal soul, or his father, beseeching his son to avenge his murder.
The supernatural in this play is a way for Shakespeare to introduce the presence of evil or evil doings, to give us a clue that dark forces are at work. It creates an unsettling atmosphere filled with fear and trepidation for Hamlet and the reader. Supernatural forces are unpredictable, we never know how they will strike or at which character.
Hamlet is also consumed with the deep and mysterious question of contemplating the nature of death. He becomes entangled in his own mind, procrastinating about what he should do regarding the murder of his father as he wanders the recesses of his mind looking for answers to the timeless questions regarding the meaning of human existence and the purpose of life.
"Not only is death pervasive, its occurrence is a product of chance and circumstance. True, Hamlet anticipates his death, while Claudius and, perhaps, Laertes deserve theirs, but Polonius dies by accident as does the Queen, while Ophelia's suicide seems to be beyond her control. Life inevitably yields death and a wormy grave, and its occurrence cannot be foreseen or avoided"
In any case, Hamlet is surrounded by death and its reminders, which in and of itself, is supernatural.
In Shakespeare's time, the supernatural, witches and spells and the tinkering with men's lives was a reality of everyday life. The King at the time, King James I, was very interested in witches and witchcraft, that is why Shakespeare put the three witches in his tribute play Macbeth, where he honors the lineage of King James's ancestors and his succession to the throne.