I hope somebody can answer your question directly but while you wait, /u/xenophontheathenian answered this question on the importance of the library of alexandra but he does touch a bit on how writings manage to survive
I just came across an explanation for why the history of Ammianus Marcellinus survived up to today. Thompson, in The Historical Work of Ammianus Marcellinus, wrote that it is definitely a matter of people thinking the history was worth preserving that makes them survive until today (really until the printing press was invented and many copies of them were made. If something managed to survive until the seventeenth century then we almost certainly have it today).
What makes Ammianus interesting is that the first thirteen books of his history are lost, while the others remain mostly entirely intact. This is probably due to the fact that the first thirteen books are copies of other histories and give the details from before Ammianus' time. From book fifteen he starts writing from his time in the army and can start putting his own observations and knowledge into the book. Thus these books became much more important and consequently survived.