I’m going to answer based on my knowledge of the manuscript traditions of ancient Greek philosophers, but I do have some awareness of the preservation of other texts that I’ve picked up along the way (e.g., of Menander).
The answer to your question varies from case to case and also probably isn’t as exciting as you’d think.
In many cases the preservation is entirely by accident. For instance, Diogenes of Oenoanda’s work was written on a portico wall, and that’s where it was preserved. Originally it was about 250 square metres and 25000 words of Epicurean philosophy, but when it was re-discovered in the 19th century, considerably less was still extant as you might imagine.
Since so much here is accidental, we can’t directly draw inferences from what we have to what was most important. But of course cultural and intellectual significance do play some role. Plato’s corpus is the only philosopher’s corpus for around 600 years to survive in full, with the next being his Platonist follower Plotinus.
(Some other important philosophers such as Chrysippus have no extant works, which doesn’t mean that they were not important. In Chrysippus’ case, things are especially unfortunate. He was the most prolific philosopher in antiquity, having written about 800 books. Plato, in contrast, didn’t even write 70. But Chrysippus’ output seems to have worked against him. It was so time-consuming and inefficient to work through his whole corpus that people even in antiquity were using sourcebooks and anthologies, and this made it easier for his works to slowly... disappear.)
The story of how Plato’s texts survive isn’t an exciting one, really. There was a long tradition of writing commentaries through antiquity and the medieval period. Slowly, for deep social reasons, the tradition of writing commentaries on Greek philosophical texts moved from the Mediterranean to the Islamic world and then, in Plato’s case, fully to Byzantium. Today, I believe that every manuscript of Plato’s texts was preserved in Byzantium, with no exceptions. This meant that there were codices or anthologies of Platonic texts written in Greek circulating in Byzantium. Since this was part of a Platonic commentary tradition, the anthologies also included the commentaries of ancient Greek philosophers such as Olympiodorus, which you can still read today translated in English like Plato’s own works. In the Renaissance, intellectuals in Florence such as Ficino could not read Greek, but were supported by wealthy patrons to go get and translate these philosophical texts after learning Greek, which is how Ficino came to be the first person to translate Plato’s texts into Latin, at the same time translating other Neoplatonic texts such as those by Plotinus, similarly preserved in Byzantium.