Hamlet is a revenge tragedy and all of Shakespeare's tragedies end in death. (You can read more about his by going to "Genre.") At the same time, the play's conclusion is deeply concerned with continuity. The royal court has been wiped out but Prince Fortinbras arrives to step in as King of Denmark, and Horatio makes a promise to Hamlet that he will tell Hamlet's tragic story.
When his beloved friend dies, Horatio begins to make good on his promise: "Good night sweet prince," he says, "And flights of angels sing thee to thy rest!" (5.2.17). Horatio, whose name recalls the Latin term "orator," interprets Hamlet's death and salvation in the most elegant terms. The voices of angels, Horatio seems to suggest, will carry Hamlet to his heavenly "rest." We're struck by the way Shakespeare seems to be making a very explicit – and pretty stunning – connection between Hamlet's eternal afterlife, the angelic voices that "sing," and the story telling that Horatio undertakes at this moment. Because Hamlet's story will be told, he'll live on for eternity in words and in the memories of the living. Judging by Hamlet's popularity, Shakespeare seems to be right.