Spoilers ahead for the Game of Thrones series finale. Just like Tyrion emphasized during his speech at the Dragon Pit, stories are vital to the survival of Westeros. So after Bran was nominated to be the next king, audiences caught a glimpse of the kingdom's future. Tyrion became Bran's Hand of the King (third time's the charm, I guess), Podrick joined the Kingsguard, and Samwell Tarly finally became a maester, just like he always wanted. Not only that, but Sam wrote A Song of Ice and Fire on GoT — and thus the wheel came full circle.
The idea that Sam would go on to write the titular book has been floating around for awhile. And it wouldn't be the first time — just look at The Lord of the Rings, wherein Bilbo puts the finishing touches on his epic, There and Back Again: A Hobbit's Tale, just ahead of his 111th birthday in the Shire. Then there's the divisive Gilmore Girls: A Year in the Life, which ended with Rory presenting her mother with a book she'd written, titled The Gilmore Girls. "Drop the 'the'" Lorelai responded. "It's cleaner."
Similarly, Sam finally put all of his hard-earned studying to good use, presenting Tyrion with a thick volume at the end of the series finale. "What's this?" the remaining Lannister asked. "A Song of Ice and Fire," Sam responded, proudly. "Archmaester Ebrose's history of the wars following the death of King Robert. I helped him with the title." Much to Tyrion's chagrin, however, the Lannister isn't mentioned in the book at all.
For those Game of Thrones fans who haven't read the books, A Song of Ice and Fire is the name of George R. R. Martin's series, on which the HBO show is based. And while the series mostly outpaced the books after Season 5, the credit goes to Martin for creating the initial universe, characters, and plots.
As for the character that Sam mentioned, Archmaester Ebrose, audiences may recall that this minor character (played by Jim Broadbent) appeared back in Season 7, when Sam began apprenticing at the Citadel in Oldtown. And while he frowned on Tarly for healing Ser Jorah of greyscale with an experimental treatment, it seems that he took a liking to Sam, since they worked on this account together. ScreenRant pointed out that audiences catch a glimpse of this in Season 7, Episode 2, when Sam helped the maester write something called A Chronicle of the Wars Following the Death of King Robert I, which Tarly suggested they find a snappier title for (it looks like he found one).
And that wasn't Sam's only contribution — when Tyrion was suggesting that they nominate a new leader, our sweet Samwell brought up the idea of democracy. His idea was, unfortunately, shot down with condescending chuckles. Maybe next time!
And as Sam explained to Tyrion, A Song of Ice and Fire begins after the death of King Robert, which is roughly where the first book — titled A Game of Thrones — picks up. The subsequent books in the series, A Clash of Kings, A Storm of Swords, A Feast for Crows, and A Dance with Dragons are all source material for the HBO series. And while it's kind of satisfying to picture Sam writing the books, it also doesn't make sense, since there are plenty of show plotlines not discussed in the books and vice versa.
There's also the fact that there are two books remaining in the series — The Winds of Winter and A Dream of Spring — and they will likely end much differently than the series has. But whether or not Sam's penning the book series felt like a satisfying end to an eight-season saga, it's nice to see the Tarly alive and well, wearing his maester outfit and far out of harm's way.