I can't imagine the play ending any other way. Hamlet is one of the greatest, if not the greatest, tragedies in literature. Everyone dies except Fortinbras and Horatio. Death, even of the innocent, is a necessary part of dramatic tragedy. The two evil acts of Claudius, killing the king and marrying his wife, are responsible for setting off the whole chain of events. In the end, Claudius' evil does not win out.
We get satisfaction from knowing that Fortinbras will take over the rule of Denmark. Unlike Hamlet, Fortinbras is successful in his vengeance for his father's death and is now king. He treats Hamlet with great respect, giving him all the funeral rites appropriate of a soldier. He praises Hamlet, saying he would "have proved most royal".
Hamlet stops Horatio from drinking the poison so he can tell the story of what happened. Horatio was loyal to Hamlet throughout the play, and it's fitting that he be spared to tell the truth of what happened in this great tragedy.
Act Five is sad, but dramatically satisfying:
Claudius challenges to a fencing match and Hamlet agrees. Claudius smugly feels that he is the better swordsman, but wants to be sure that this match will be the end of his nephew. He has a goblet of poisoned wine ready, intended for Hamlet.
The battle begins, with Hamlet landing the first blow. Hamlet is offered the wine but refuses. Hamlet strikes Claudius a second time. Gertrude is pleased with her son’s ability. She drinks to his success from the poisoned cup, obviously unaware of its lethal ingredient.
Laertes joins the fray and wounds a defenseless Hamlet. The swords he uses are tipped with poison, yet another attempt by Claudius to assure Hamlet’s death. Hamlet acquires a sword and wounds Laertes with one of the poisoned rapiers.
Meanwhile, Gertrude is feeling the poison travel through her body. As she is dying, the wounded Laertes reveals the plot of the wine and swords. Hamlet attacks Claudius, stabbing him and forcing him to drink the wine.
Everyone is dead or dying. Hamlet, before he expires, asks Horatio to tell his story to the world.
It is a dramatically satisfying end. Claudius and Gertrude pay; Hamlet avenges his father's death, and Hamlet's truth will live on through the faithful Horatio.