The origins of libraries are as vague as the evolution of living species. Just when did a room full of clay tablets transform from an accounting office into a library? We will never really know because the evidence is lost. Whoever first kept a collection of documents other than sales receipts, perhaps a collection of letters, epitaphs, or royal proclamations, would not have foreseen the implications of his action. In Libraries in the Ancient World, Lionel Casson reports the first known library was in Nippur in southern Mesopotamia where archeologists have found a group of clay tablets dating from the third millennium BCE that served as a sort of reference collection; they listed geographical places and names of the gods, identified professions, offered exercises for improving writing skills, and recorded lyrics of hymns.
In the majority of chapters of Libraries in the Ancient World, Casson focuses on libraries from ancient Egypt, Greece, and Rome, providing cities and dates, describing buildings, and reporting on collections. He also comments on what is known about the librarians and their staffs and what services were provided for readers. There was often a library catalogue, though it might be more of a chronological accession list on a tablet or scroll. Zenodotus at the library of Alexandria appears to have invented alphabetization. Some libraries inscribed the titles they held into the stone walls.
Through much of the ancient times, books were collections of papyrus or parchment scrolls that were either stacked on nooks or kept in buckets. Library staff usually brought groups of scrolls to the reader. No self-service. When codices (flat books made of papyrus or parchment between covers of wood or ivory) began to be used, librarians had to reorganize to shelve them. Libraries had to keep both scrolls and codices were centuries as the adaptation to the new technology was very slow. (Imagine that we still needed to keep 8 mm films and 8-track tapes in our public libraries.)
Where libraries got their books is a major topic in Casson's book. Remember that their was no printing press in the ancient world. Everything was handwritten. Usually authors wrote single copies for whatever purpose they had, and they would let others make copies. Of course, scholars did not have time to transcribe, so they assigned the work to their slaves. Libraries might acquire titles as gifts from authors or the scholars who had copies made, or the libraries assigned their own slaves to make copies. Libraries benefited greatly when local generals sacked other cities and brought back the books. In later periods there were bookstores, but copies of books made for profit were known to have more transcription errors. Libraries did not want hastily-made bookstore copies if there was any other choice.
Collecting books, cataloguing them, loaning them to readers, and adapting to changes in technology. We are still doing what we have always done. Check it out.
Casson, Lionel. Libraries in the Ancient World. Yale University Press, 2001. 177p. ISBN 9780300097214.