Samwise's practical nature and good sense make him an asset to Frodo in his quest to destroy the One Ring. In addition to these strong qualities, Sam also comes to represent the virtue of mirth, often adding unlooked for moments of humor in Frodo's darkest times. The moment at the Black Gate is great example of Sam's ability to inject the worst possible situation with both common sense and his humorous take on things:
"My word, but the Gaffer would have a thing or two to say, if he saw me now! Often said I'd come to a bad end, if I didn't watch my step, he did. But now I don't suppose I'll ever see the old fellow again. He'll miss his chance of I told 'ee so, Sam: more's the pity [...] But I'd have to get a wash first, or he wouldn't know me" (623).
Tolkien uses Sam's levity to help balance the intensely psychological struggles of Frodo, which makes Frodo's journey much more bearable through the last part of The Lord of the Rings. From a literary standpoint, Sam's humor helps diffuse the tension of the rising action by providing comic relief. Sam's humor, not only helps Frodo to stay centered and keep going, but it also helps the reader keep going as well--because let's face it, Frodo and Gollum finishing the journey alone and without Sam would have been a pretty dismal read for the audience.