Hamlet's father, the King of Denmark, is killed by his brother, Claudius, and Claudius becomes King and marries Hamlet's mother, Gertrude. The Ghost of Hamlet's father visits Hamlet, telling him to avenge his murder. Hamlet pretends to be insane to his family and friends, and even to Ophelia, the woman he loves, in order to investigate more openly (like a Shakespearean Fool, no one will pay him any notice).
For the rest of the play, Hamlet agonizes over whether, when and how to get revenge for his father. He is torn because to avenge his father, he must kill the present King, his uncle, and his mother's husband.
He stabs Polonius not knowing who he has stabbed but being alarmed because of Polonius's cries for help from where he is hiding behind the tapestry.
Claudius then sends Hamlet away in an attempt to have Hamlet killed in England, but Hamlet learns of the plot, escapes and returns to Denmark.
Ophelia goes mad after Hamlet kills her father (Polonius), and her brother Laertes wants revenge against Hamlet for both tragedies, death and madness. They then learn that Ophelia has killed herself. Claudius helps Laertes by setting up a sword fight between Hamlet and Laertes and by poisoning the sword tip and a glass of wine in case Laertes' sword doesn't kill him.
At the sword fighting match held before the assembled court, Hamlet's mother, Gertrude, accidentally drinks the poison wine and dies. Laertes wounds Hamlet with the poisoned sword. They scuffle and get each other's swords. Hamlet wounds Laertes with the poisoned sword. Laertes begs forgiveness and points the guilt to Claudius. Laertes dies.
Hamlet stabs Claudius with the poisoned sword and forces him to drink what's left of the poisoned wine. Claudius dies. Hamlet speaks to Horatio and names Fortinbras, the man who asks no questions but acts decisively, as his successor.