William Shakespeare is responsible for perhaps the greatest number of literary quotes, such as Hamlet's "To be or not to be." Famous quotes tend to be drawn from books known as the Classics, which starts with Homer's Iliad and Odyssey and runs the whole of literary history.
Because of their concision, books of poetry often provide the greatest number of literary quotes. For example, Shakespeare's Sonnet 18 begins "Shall I compare thee to a summer's day?" Milton's Paradise Lost has "Better to reign in Hell, than serve in Heaven." Similarly, William Butler Yeats' The Second Coming has the famous line "Things fall apart, the centre cannot hold." Thanks to their aphoristic quality, these quotes tend to fit into many different contexts.
However, famous novels are often recognized by their opening or closing lines. For example, Jane Austen's novel Pride and Prejudice begins with, "It is a truth universally acknowledged, that a single man in possession of a good fortune must be in want of a wife." Meanwhile, Leo Tolstoy's novel Anna Karenina begins, "Happy families are all alike; every unhappy family is unhappy in its own way." Both of these quotes are so recognizable as to be known independent of the work they come from.