Sadly, most of the stuff that was written down in antiquity actually has been lost or destroyed over the millenia. What we have is very fragmentary, and comes to us mainly through medieval copies of original texts. Monasteries in the middle ages kept libraries of ancient works, and regularly copied and recopied their manuscripts. Some texts have more reliable and complete manuscript traditions than others - the Annals and Histories of Tacitus (Roman Imperial period historian), for example, are almost entirely lost. If you're interested in a specific Greek or Latin text, then the introductions to the Loeb translations often discuss the history of how the source has been transmitted.
Aside from medieval manuscripts, some papyrus texts were preserved in the desert sands of Egypt. The town of Oxyrhynchus in particular had yielded a huge number of papyri, some of which contain fragments of work by famous authors. Scholars of Greek literature were very excited a few years ago when two new poems by Sappho came to light, for example (https://www.theguardian.com/world/2014/jan/29/sappho-ancient-greek-poet-unknown-works-discovered?).