In a nutshell, nobody knows for sure. We can make educated guesses, based on what we believe about the culture and customs of ancient Greece. Socrates' students also slipped us clues as they portrayed the famous philosopher in their own writings.
Why didn't Socrates write any books? After all, he was supposed to be so intelligent and wise.
Back in the day (around 425 B.C.), books were hard to find and tough to afford. Socrates lived in a time when important business was handled through speaking, rather than writing. Some say that Socrates didn't write things down because he was forever asking questions, always learning, and perpetually deepening his viewpoint. An idea captured once for future generations wouldn't reflect his ever-developing body of knowledge.
Nowadays, we look to a series of dialogues written by Plato as a chief source of insight into Socrates. Plato, student of Socrates and teacher of Aristotle, shared perspective on his teacher in several works, including the four dialogues of The Trial and Death of Socrates. Plato was able to create a Socrates of his own design, according to interpretation and imagination. In Phaedrus, Plato brings into being a Socrates who says that writing is "inhuman, pretending to establish outside the mind what in reality can be only in the mind" — an especially interesting consideration because of the way it's been preserved for more than 2,000 years — in writing!