For being written 3-4 thousand years ago, we know a crazy amount about the Epic of Gilgamesh. We know most of the character’s names, their relationships, motivations, personalities, as well as many of the individual plot points fairly well.
How are we able to know so much about this story compared to others from that time or even significantly later? Does it just have to do with the amount of time and effort put into its study? The tablets it was written on being sturdier than paper? Being in a region that gave way to cultures that encouraged scholarship and study? Or something completely different?
Lots of copies, basically. That's always the best avenue for an ancient text to survive to the present. Leaving aside older variants and just focusing on the Standard Version, there are nearly 200 fragments of the epic in existence -- there were 108 fragments known at the time of Campbell Thompson's 1928 edition, 184 at the time of Andrew George's 2003 edition, and more have been discovered since then, representing 73 distinct manuscripts.
The material they're written on only matters in conjunction with other factors. Contrary to what memes may say, clay tablets are not notably long-lived: it's just that in the timeframe we're talking about, that's the only kind of documentation that existed, so anything that did survive necessarily survived in that form. Take a library, wait a thousand years, and only 0.01% of all documents are going to survive, no matter what they're written on. (This doesn't apply to monumental stone inscriptions, which have a better survival rate -- probably over 1%!)
Besides, clay tablets only survive if they get baked, and most such bakings are not done on purpose.
The most important group of copies are the 34 or 35 from Ashurbanipal's library in Nineveh, which got baked when the citadel was burnt in 612 BCE. Even there, we can be reasonably sure most of the library was not baked and so was lost. It's the conjunction of (a) being on clay tablets, (b) being in a single important archive that happened to get burnt, and (c) existing in lots and lots of copies -- between them, these three factors are responsible for a fair amount of Gilgamesh.
Yes, the book culture surrounding the royal libraries of Nineveh were essential to the survival of Gilgamesh. Andrew George reports two inventories from the mid-600s BCE which report acquisitions of new copies of Gilgamesh: it was being actively sought out. And Ashurbanipal had an active scriptorium that produced new copies of books.
But it wasn't the only collection, and copies from elsewhere have become more important over the last century. Even among the Nineveh fragments, one has a colophon indicating that it was acquired from another collection, the library of Nabu-zuqup-kenu, who lived in the 8th century. Other colophons don't indicate royal ownership, indicating that they came from other collections.
At the time of Thompson's edition, the Nineveh copies were nearly all that he had. Andrew George had 38 or 39 copies from elsewhere too: from Babylon, Ashur, Sultantepe, and Nimrud. A new fragment from southern Iraq was acquired by the Sulaymaniyah Museum in 2011 from a smuggler's collection, meaning the exact provenance is uncertain. The latest manuscript comes from Ashur around 130 BCE, nearly half a millennium after the end of the Assyrian Empire: that is, Gilgamesh was still being read and copied at the time of the Seleucid and Parthian Empires. I can't give you as full an account of Parthian book culture as I'd like, or even Seleucid -- but if you want to find out more, those are the things to be researching.