Évariste Galois: Galois essentially founded modern abstract algebra. Galois died in a duel at age 20. No one knows what motivated the duel, but the night before the duel he was so sure of his own death he wrote many letters to his friends containing all the mathematics he had discovered. How monumental his contributions were was not realized until decades after his death.
Georg Cantor: Cantor made major contributions to set theory, especially with regards to infinite sets. His papers about infinity were very controversial. Some mathematicians believed infinity belonged in the realm of philosophy. Some theologians believed that only God was infinite, and thus Cantor’s argument was a foray into pantheism. This extreme criticism led Cantor into great depression. Henri Poincare, (one of my favorite mathematicians), quipped “later generations will regard [Cantor’s set theory] as a disease from which one has recovered”. He lived the final years of his life extremely disturbed.
Felix Hausdorff: Hausdorff contributed to set theory and topology (my favorite subject!). Although he attempted to get a position as a professor in the United States, Hausdorff was unable to escape Germany as the Nazis rose to power. He and his wife committed suicide to avoid concentration camps.
C. P. Ramanujam: Ramanujam made major modern advances in algebraic geometry, one of the most difficult fields of current mathematical research. Despite being one of the most prolific, brilliant mathematicians of the mid-20th century, he constantly felt that he was not contributing enough. He tortured himself with the exceedingly high standards he placed for himself and for all of mathematics. Eventually schizophrenia overtook his life, and he committed suicide.
Pythagoras: Pythagoras discovered the theorem which bears his name (though some historians believe the Egyptians may have discovered it first). According to legend, Pythagoras thought beans were horrid things because they symbolically represented testicles. Thus when a mob chased him to execute him, and he was chased to a bean field, he stopped. Because of his refusal to enter the bean field, he was murdered.
Kurt Gödel: Gödel researched logic, set theory, and foundations of mathematics. He is best known for his incompleteness theorems, which had a huge impact on mathematics, and especially on the philosophy of mathematics. During the last years of his life, Gödel became obsessed with the fear that someone would poison his food – so much so that he starved himself to death.