Philologists were able to understand Sumerian thanks to Sumerian-Akkadian bilingual inscriptions. It took a few decades, and there's still disagreement about certain aspects of Sumerian grammar.
A lot more can be said on the topic, but I wrote about the discovery and decipherment of Sumerian in When did the modern understanding of the history of Bronze Age Mesopotamia develop?
Hi, not discouraging another contributions here, but just fyi, you can get started on some earlier answers
/u/wedgehead in When and how were cuneiform languages (like Akkadian and Sumerian) first deciphered by modern scholars?
/u/farquier in If Sumerian is a language isolate, how was it deciphered? and When was the Sumerian civilization 'lost'? When was it rediscovered?
these comments about Sumerian as an isolate may be of additional interest
/u/commodorecoco in Where did the Sumerians come from and what's so special about their language?
/u/keyilan in How is Sumerian a language isolate?
I'll take a crack at this question by by differentiating between the Sumerian language and the Sumerian writing system. We know a fair bit about the writing system; however, we know much less on what the Sumerian language itself was like in a linguistic sense, and so 'what they were saying’ has for the moment been partially lost.
The Sumerian writing system was not conceived to record the details of the spoken language; it's thought it was conceived as a kind of memory aid, in the manner we might use a bulleted list of acronyms today, or even a shopping list, to aid in administration. The writing system began as largely pictographic, and then evolved to encompass ideographic and logographic signs (signs standing for a concept, or entire words or phrases) and for this reason it does not preserve the full grammar, all of the vocabulary, or what the language sounded like (e.g., a picture of a bull for example does not convey what the Sumerian word for bull was, or necessarily how it sounded).
Unfortunately, the majority of texts that have survived come down to us from the end of the third to the beginning of the second millennium, and by the end of the Neo-Sumerian period (2200-2000 BCE), it becomes clear the original language is obscure to the contemporary scribes, and so has begun to deteriorate. The writing system transformed under Akkadian influence (likely to facilitate learning by scribes at a time when the spoken language was already extinct), and gradually includes more Akkadian-isms. Misunderstood aspects of the Sumerian writing then get dropped off, until we're left with something of an administrative and contrived literary language (not unlike the Standard Babylonian of the first millennium, with another analogy being Church Latin).
An important dissertation by Jagersma at Leiden University completed in 2010 concluded it was impossible to write a linguistics-based grammar on the Old Sumerian texts from the First Dynasty of Lagash (2500-2350 BCE), as it was too limited a corpus. This was attempted, known, and concluded by Sollberger in the early 50s based on philologic expertise, but what this dissertation in 2010 illustrates is that an application of modern linguistics confirms that there still aren’t enough Old Sumerian texts in existence to linguistically reconstruct the Old Sumerian language -- i.e., Sumerian in its original context. The writing system is just too defective. Consequently, the scope of this dissertation had to expand to complete the grammar (which had to involve the inclusion of the 'Akkadianized’ Neo-Sumerian and Old Babylonian texts). So, barring the discovery of another major corpus, the original Old Sumerian language has not survived — because it was almost certainly in decline if not already extinct as a spoken language during the Gutian period (first half of Neo-Sumerian period).
While we do have substantial Sumerian-Akkadian lexical texts that are long lists and could and likely did function as bilingual dictionaries, they record how Sumerian words were written, but do not record the original Sumerian language — which may never be fully recovered.
Sources:
Jagersma, Abraham H. A Descriptive Grammar of Sumerian. Leiden, 2010.
Edzard, Dietz Otto. "Sumerian Grammar”. Leiden, 2003.
Thomsen, Marie-Louise. “The Sumerian Language”. Akademisk Forlag, 2001.