What historical events of that time contributed in the writing of Candide?
This work was written in 1759. It is both a satire or life and a parody of a romantic adventure story in which the main character, a young man named Candide, is forced out into the world by a series of fantastic and sometimes unfortunate events where he "comes of age." Candide's coming of age results in a drawn-out, painful disillusionment as he witnesses many difficulties in the world. He starts out echoing the positive philosophy of his tutor, who assures him that this is the "best of all possible worlds" but he learns that the world is just the opposite by the end of the novella.
One major historical event that is referred to in the work is the Seven Years' War. This war involved most of the countries of Europe - Prussia, England and Germany (some German states) against Austria, France and Sweden. Russia swtiched sides in the conflict. The war started in 1756 and ended in 1763 - 7 years.
In 1755, there was a huge earthquake in Spain which caused terrible tidal waves. Candide is caught in this storm in Lisbon Harbor and almost drowns. The Spanish authorities conduct a "test of faith" (auto-da-fé) to prevent further earthquakes, and Pangloss is hanged. Auto-da-fés were actual historic events that took place during the Spanish Inquisition, which began much earlier in history - 1478 - but which were not abolished until 1833. An auto-da-fé was supposed to ferret out heretics and many innocent people were tortured under them.
These disasters caused Voltaire to question the meaning of life. He was very disillusioned by these events and in Candide, his disillusionment is illustrated through satire and parody.
Read about it here on enotes.