King Hamlet was poisoned in the ear by his brother, which curdled his blood. The ghost of said king tells Hamlet of Claudius' crime and told him to remember. To right the wrong of Claudius' crime he must be put to death.
Since the ghost was not given last rites, then he is trapped in purgatory. Hamlet plans to act crazy so no one would be on to his plan to murder Claudius. Hamlet eventually calls upon Horatio for aid.
Hamlet is killed in the end, but he did not die alone. Laertes, Claudius, and Gertrude