Horatio is one of the only characters to survive the dramatic ending of Hamlet, and will serve to tell Hamlet's story to the kindgom, and to future generations. In fact, as Hamlet is dying, he specifically requests of Horatio that he tell his story. Horatio, throughout the entire play, has been a true and faithful friend to Hamlet, someone that Hamlet can vent to, and share his feelings. In the end, it is to this very cherished friend that Hamlet turns, pleading that his memory will be remembered. Horatio is the designated story-bearer. Also, Hamlet asks him to go to Fortinbras and relate the events of the day, so not only is Horatio tasked with telling Hamlet's tale, but in being a military messenger too. He is the last standing pillar in the tragic story of Hamlet, and will be the one to forge peace with enemies and friends, and ensure that Hamlet's memory will be remembered. I hope that helped; good luck!
In Shakespeare's Hamlet, Horatio is the go-to guy throughout the play. The guards go to him when they see a ghost. Hamlet confides to him his plans to fake madness. Hamlet seeks his help with his plan to trap the king during the production of the "play-within-the-play."
At the conclusion, Horatio is so loyal that he is willing to commit suicide when his friend, Hamlet, is dying. But Hamlet stops him. Horatio, always the trusted friend, must stay alive to tell the tale of what really happened in Denmark.
Also, looking at the situation practically, Horatio provides occasions for Hamlet to speak. In other words, since this is a drama and no narrator exists, dialogue is one of the methods used to reveal plot, characterization, intentions, etc. Practically speaking, Horatio is present in the final scene to give Hamlet someone to talk to, to give Hamlet someone to reveal his thoughts to so the audience can hear them.