It is well known that Évariste Galois died a young man. I have heard that he died in a duel. What was the duel about? More rather what is the back story behind his death and did he really write down most of his great ideas days before his death?
According to the Rutger's University webpage Mathematics - Means to an End, which lists the reasons for deaths of famous mathematicians, state that there is a considerable amount of uncertainty about Galois' death. However, they speculate that
indicate that the duel was motivated either by a matter related to his involvement with the radical Républicain movement, or by conflict arising from a romantic entanglement. The duel occurred only a month after his release from a six-month incarceration stemming from his disruptive political activities.
The site also states that having predicting his own demise, he wrote down his work the night before.
The most likely reason is: He was weary of life, because of his unhappy love affair, his fruitless efforts for gaining recognition for his mathematical work, his financial and work situation and he felt finished up a blind alley in politics as well. So his duel was like a staged suicide.
There is some further evidence to Galois malaise presented in the National University of Singapore's paper Evariste Galois, describing that he endured several disappointments academically and romantically, and according to the author, had become bitter, and the conclusion that the author makes is quite salient:
If he had known that his work would be of great significance to mathematics, life would have been more meaningful for him. As it was, he died a very disappointed man.
I'd lile to mention two interesting papers written by Olivier Courcelle, that have been very recently published on the excellent Image des mathématiques website. The papers, written in French, contain numerous and previously unpublished details about the identity of Galois' duel opponent. They may not directly answer the original question, but I think they are worth mentioning.
In the first paper, L'Adversaire de Galois (I), he mostly addresses the question of who the opponent was. He mentions that the newspaper Le Précurseur of June 4th 1832 reports about Galois' death and mentions the initals of his opponent, L. D. (centre column of the referenced page). In his Mémoires, Alexandre Dumas names the opponent as being Pescheux d’Herbinville. According to Courcelle, these elements do not conflict, as Pescheux was sometimes called Lepescheux, just as Galois has been referenced as Legallois in some situations.
Concerning the reasons for a duel, the author points to various sources, including a letter by Galois himself, none of them supporting the love story theory.
In the second paper, L'Adversaire de Galois (II), published today, Courcelle reveals previously unpublished biographical elements about Pescheux d’Herbinville, that he was able to find by scouring numerous archives and registers. He concludes his paper with the full identity of the man: Étienne-François Pecheux d’Herbenville (Paris, April 5th 1809 – Paris, march 23rd 1871).
There have been many accounts of the life of Galois and the duel. Most sources suggest that the duel was due to a failed love affair. It seems Galois fell in love with the physician's daughter when he was in jail, but as happens most of the time, the girl was not in love with Galois but someone else. Galois challenged him to a duel and the rest is now known. It was very common back then to challenge one another to a duel to resolve matters, but what was sad was that Galois had to lie there after the duel for many hours before help reached him. Perhaps timely help would have saved him. But that is just speculation.
As for the matter of whether he wrote most of his math before he died, that would most certainly be false because he must have had the idea beforehand. He just wrote it down before the night of his duel for safety and sent it to Chavelier. Hermann Weyl says about this letter : "This letter, if judged by the novelty and profundity of ideas it contains, is perhaps the most substantial piece of writing in the whole literature of mankind."
The same Galois gives two different reasons for the duel in its two last letters:
In the "Letter to all Republicans":
I beg patriots and my friends not to reproach me for dying otherwise than for my country. I die the victim of an infamous coquette. It is in a miserable brawl that my life is extinguished. Oh! Why die for so trivial a thing, die for something so despicable! Pardon for those who have killed me, they are of good faith.
In the letter to two un-named friends:
I have been challenged by two patriots - it was impossible for me to refuse. I beg your pardon for having advised neither of you. But my opponents had put me on my honour not to warn any patriot. Your task is very simple: prove that I fought in spite of myself.... Preserve my memory since fate has not given me life for my country to know my name. I die your friend.