Francis Fukuyama in The New York Times:
Context is particularly important in Nietzsche’s case because his life story was so dramatic. The young Friedrich (or Fritz, as he was known) was, by all accounts, simply the most brilliant student any of his formidable professors had ever encountered, going all the way back to his boarding school days at Pforta. His teacher of classical philology at Leipzig, Friedrich Ritschl, said that in his 39 years of teaching he had “never known a young man who has matured so early.” Nietzsche was awarded a doctorate at age 24 and a professorship at the University of Basel the same year; he was promoted to full professor at 25 — a feat not even Larry Summers could duplicate.
From a very early age, however, Nietzsche was afflicted with a host of maladies, including blinding headaches that would last for days, problems with his digestion that would leave him vomiting and bedridden, and a progressive blindness that allowed him to read, painfully, for only a couple of hours a day. So debilitating did these symptoms become that he was forced to give up his professorship at age 34, after which he withdrew into a solitary and nomadic life, traveling between Switzerland and the South of France in search of a climate that would marginally ease his suffering. His great works were written in the few days of lucidity that were permitted him between long bouts of physical disability, “On the Genealogy of Morals” having been composed for the most part in a mere three weeks in 1887.
More here.