Because he is unable to kill his uncle, Hamlet interrogates his mom on her marriage. During their discussion, he hears someone eavesdropping, and immediately assumes its Claudius, and kills him, only to find out it's Polonius instead.
O what a rash and bloody deed is this!
Do it, England, For like the hectic in my blood he rages, And thou must cure me.
Once Hamlet is banished, Claudius writes to the King of England to have Hamlet killed.
Hamlet escapes prison in England and comes back. When Laertes, Polonius's son and Ophelia's brother, comes back as well to find that his sister has drowned and his Dad was killed, he gets angry and blames Hamlet. Claudius originally plans to poison Hamlet, but his wife ends up drinking instead and dies, so he asks Laertes to fight and kill Hamlet and he agrees. Hamlet and Laertes both die, as well as Claudius. Horatio, Hamlet's friend, is the only one to survive.
Now cracks a noble heart. Goodnight sweet prince, And flights of Angels sing thy to rest.