"Well, I'm back."
The words with which JRR Tolkien chose to end The Lord of the Rings are basic but effective, just like the character who speaks them. Sam Gamgee seems at first like a secondary member of the Fellowship. Over the course of their journey, return and restoration of peace in the Shire, though, Sam becomes much more than just Frodo Baggins' accompaniment and guard. He becomes the reason the Ring is destroyed at all--his willingness and ability to support Frodo throughout the latter parts of their journey are the reason the pair manage to get to Mordor. Sam, unlike Frodo, is able to complete his mission, overcome it and return to the Shire to live. Unlike Frodo, he shows no long-term ill effects from the journey the Fellowship took.
It is Sam, not Frodo, who is the ultimate hero of The Lord of the Rings.
There are many different hero archetypes on display throughout the books--Aragorn, born into a noble family and destined for great things; Frodo, the doomed hero who ultimately fails to overcome his personal "dragon"--the Ring; and Eowyn, whose martial prowess conflicts with the position she is intended to hold in life. Sam is different from all of the other heroes in the book because his ultimate mission is not inwardly driven. He wants to go along with his master to help keep him safe.
At the council of Elrond, he betrays his hiding place out of worry for Frodo. "'But you won't send him off alone, surely, Master?' cried Sam, unable to contain himself any longer, and jumping up from the corner where he had been quietly sitting on the floor" (LotR 271). Significantly, Sam doesn't specifically ask to be sent with Frodo. He is simply concerned that Frodo not be sent on his own. Merry and Pippin, on the other hand, beg to be allowed to be a part of the party. While Gandalf supports their request, Elrond is initially unsure. This stands in stark contrast to the situation with Sam--he stood and protested Frodo being sent alone and was immediately told he could accompany his master. Clearly, Elrond sees some moral fortitude within Sam that will make him invaluable to the Fellowship.
In the later stages of the journey, Sam becomes increasingly important. In the encounter with Shelob, Sam's character makes a huge stride. The title of the chapter, "The Choices of Master Samwise," reflects this change. At the beginning of his battle with Shelob, "'now come, you filth!' he cried. 'You've hurt my master, you brute, and you'll pay for it'" (LotR 730). It is not only concern for Frodo that enables Sam to defeat Shelob. His own confidence is boosted by anger and allows him to channel some kind of power from the sword and send Shelob back into her cave once and for all. Sam's conversation with the comatose Frodo after the battle demonstrates Sam's character progression--"'O, wake up, Frodo, me dear, me dear. Wake up!'" (LotR 730). He has moved into the final stages of accomplishing his journey.After this point, Sam and Frodo's relationship is one of caretaker and cared-for rather than master and servant.
Ultimately, Sam's selfless mission allows him to come out of the journey relatively unscathed. His desire to put down roots in the Shire and make a life for himself ultimately overcomes his feelings of servitude to Frodo--he doesn't choose to sail west with Frodo and the elves. Frodo is right when he tells Sam, '"You cannot always be torn in two. You will have to be one and whole for many years'" (LotR 1029). No longer does Sam need to take on both his own burdens and Frodo's. He can now focus on his true purpose--restoring the Shire. Sam is not broken by the journey because of his selfless motives and his next demonstration of selflessness--getting the Shire back to its former glory--will allow him to get past his need to constantly be serving Frodo.
The message in Sam's story is that the best hero is one who serves by choosing to do so and that accomplishing the mission of helping someone else can ultimately be the key to that person finishing his or her mission. Without Sam, the Ring would never have been destroyed; even if it were, the Shire would not have been restored to its former glory. Sam is not a tragic hero like Frodo or a born king like Aragorn. His breed of heroism is one of selfless service and trimming leaves.