How is Hamlet's good name restored in Hamlet?
By the end of Act 5 the stage is a pretty dismal sight--King Claudius, Queen Gertrude, Hamlet and Leartes are all dead and laying on the floor as Fortinbras marches in. Luckily, Horatio is there to explain the situation and clear Hamlet of any true responsibility for what has happened. When Hamlet was first poisoned, Horatio contemplated killing himself as well, but Hamlet swiftly reminds him that Horatio has to continue to live "in this harsh world" and "draw thy breath in pain" because he has to "tell my story."
Fortinbras asks what happened here, and Horatio gives a very succinct summation of the play when he says:
Let me speak to the yet unknowing world
How these things came about. So shall you hear
Of carnal, bloody, and unnatural acts;
Of accidental judgments, casual slaughters;
Of deaths put on by cunning and forced cause;
And, in this upshot, purposes mistook
Fall'n un the inventors' heads."
Without this explanation, it could look like Hamlet is responsible for everyone's death, but if you look carefully at the above speech and consider the play, you can connect each phrase to a specific death in the play. For example, the "carnal, bloody unnatural acts" is likely referring to Claudius's murder of his own brother and the subsequent marriage to his brother's widow. The death that falls on the inventor's head refers most specifically to Laertes as his poison is ultimately used against him.
We can see that Fortinbras takes Horatio's story to heart because he shows the dead Hamlet the respect that the prince deserves.