The brilliant Michael Dirda writing in the most recent issue of The Washington Post's book review:
The attempt to justify the ways of God to men -- theodicy, a term coined by Leibniz -- lies at the heart of the matter: "Why is there any evil at all in God's creation?" Essentially, Leibniz's answer is: Consider the whole. Explains Nadler, "It is not that everything will turn out for the best for me or for anyone else in particular. Nor is it necessarily the case that any other possible world would have been worse for me or for anyone else. Rather, Leibniz claims that any other possible world is worse overall than this one, regardless of any single person's fortunes in it." What is good for the whole isn't necessarily good for every one of its individual parts or components. As Nadler emphasizes, summarizing Leibniz, "all things are connected and every single aspect of the world makes a contribution to its being the best world."
That includes what we call evil. However, Leibniz offers no explanation of just how evil assists the overall goodness of things. (Sometimes he even seems to suggest that it serves to bring the good into greater relief.) We cannot penetrate so far into the Creator's mind or plan. Still "it is inconceivable . . . that an infinitely good and perfect God could choose anything less than the best." This conclusion may satisfy a devout Christian philosopher, but it offers scant consolation when we are in pain, or see the wicked succeed and the worthy fail, or when we face death.