In, Hamlet, Shakespeare gives a recipe for disaster: hubris (arrogance) leads to hamartia (a mistake) which, in turn, causes the irreversible downfall of its hero, culminating in death.
Hamlet is the only major character in the play with a conscience. In fact, his Superego is too developed. He knows too well that Claudius is an incestuous, adulterous murderer, that "Denmark's a prison," that "Frailty, thy name is woman." This, of course, inflates his moral pride to excess.
Hamlet is so bent on sending his and his father's souls to heaven and Claudius' soul to hell that he becomes unable to act. His moral reservations against personal revenge cause delay. His "holier than thou" attitude allows Claudius to maneuver, expose, and kill him. Hamlet is more interested, it seems, in instilling Claudius with guilt than he is with carrying out the Ghost's wishes. He is also too concerned over his mother's infidelity and incest. He wants to punish Claudius and Gertrude morally before punishing them physically. These are Hamlet's tragic mistakes that lead to his own death.