That God exists and there are instances of evil and suffering in the world are propositions many take to be contradictory. Much of the intuition driving this is the conceptualization of God. If God is all good, then He would desire to bring about a state of affairs for sentient creatures without the evil and suffering we experience. And if God were all-powerful, He could bring about such a state of affairs.
In the early 18th-century, Leibniz argued that when God created the world, He created the best of all possible worlds. Reason demonstrates that God exists and illuminates many divine perfections. Since God is perfect in every way, to create less than the best would be a contradiction. Leibniz thinks that God and evil can be reconciled if we keep in mind the dictates of reason and avoid anthropocentrism. I think Leibniz's Theodicy is sound and should be taken more seriously as an option by theists. I believe his notion of determinism in light of his theory of action are more agreeable than commonly thought.
Leibniz's position has been subject to severe ridicule. Voltaire famously lampooned the idea of 'best possible world' in Candide. Many thinkers from Leibniz to the present day have had a field day criticizing Leibniz for his Theodicy. I would argue the consensus is that Leibniz steps too far in asserting this is the best possible world. Surely, it is not a contradiction to think a world we inhabit could have had one less human or animal death. Most would think that such a (slightly different than ours) world would be better. And from here the reasoning proceeds that there is a possible world with no suffering and evil, or at least a world without gratuitous (inexplicable) evils, and God (if He were all good) should have actualized that one.
In response, some theists argue that it is possible God could not have actualized a world containing morally free creatures without any evil, and this is sufficient to show no contradiction with our experience. I think Leibniz would only sympathize with this reasoning to a certain extent. He would agree with the 'no contradiction' approach to resolving the tension, but would not agree with the speculative or agnostic (skeptical) nature of the approach.
Leibniz adopts what has been called a strong principle of sufficient reason (PSR). This means that "No fact can hold or be real, and no proposition can be true, unless there is a sufficient reason why it is so and not otherwise" (Monadology). This means there is no truth for which a reason does not subsist. For Leibniz, this principle helps lead us to the conclusion that God exists. Further exploring this conclusion, we affirm divine perfections such as wisdom and goodness. When we recognize that God has created the world, we must think that He technically had a choice as to which possible world to actualize, and that He brought this one into being for a reason. Being Supreme Reason itself, God could not act without a reason. It is therefore wrong in a certain sense to say God could have actualized another world because that would attribute caprice to the divine decree. There were other worlds that were logically possible, in the most strict sense prior to the divine decree to create. However, subsequent to God's decision to create, He must create the best.
Leibniz attributes to God the same type of action theory as rational creatures. Reason requires us to affirm this. The conclusions here follow closely in the Scholastic tradition, heavily informed by Aristotle, viz. the intellect of the rational agent apprehends the good and the will moves the agent to act toward the good. Because God is all-good and perfect, the divine intellect knows the best of all the possible worlds to actualize given the overall purposes of creation. The divine will then actualizes the best world. None of this is meant to predicate time, movement, or learning/discursive reasoning to God. Rather, it is a way of partially explaining things in humanly understandable terms. Leibniz is unclear (to me) regarding the type of predication applied to God (univocal vs. analogical), but I think either side can take his general points. For Leibniz, things are determined in the sense that they happen for a reason, and the reason they happen is the rational action of an agent (God or creature). Leibniz is very careful to distinguish his view of determinism from fatalism, which holds that there are no genuine creaturely causes and everything that happens is not a result of rational choice.
In Theodicy, Leibniz distinguishes between the antecedent and consequent will in God. Prior to creation, and in general, as an outworking of His nature, God desires the good. Part of this good entails free rational creatures. In light of the creative decree, God wills there to exist evil and suffering as the logical consequence of creaturely freedom. This would be the consequent will of God. It seems to me Leibniz sides with more of a Molinist view on foreknowledge and creaturely freedom, which holds that God knows all counterfactuals of creaturely existence and choice. Prior to creating, God knows what any free creature would do in any circumstance in which they would come to exist. In the world God actualizes, He thus knows what every free creature will do because He knows the circumstances that will be actualized.
Given the strong PSR, which I think is defensible (although controversial), and what follows from that (leaving aside Leibniz's views on the material vs. immaterial), we can conclude that God has a reason, bound up within His own demonstrable nature of perfect goodness and wisdom, for actualizing the world we have. The world entails suffering. There is a reason for it. We may not know the reason. But all arguments to the contrary must fail because they ultimately violate reason by denying God or His attributes. We must not reduce God where His sole concern is temporal human happiness or lack of suffering. The horrendous evils we experience can be reasonably subsumed under the divine providential plan that takes into account the perpetuity of the spiritual existence of human souls as well as the totality of the cosmos, which includes other spiritual creatures, animals, plant life, and possibly extraterrestrial life in sundry forms. Indeed, God loves and has provided a means of salvation from sin and its ravages. The evil we experience is the result of sin in some way (whether moral or physical). Sin was wrought by the illicit use of creaturely freedom.
What seems unpalatable for those opposed to Leibniz is that it seems intuitive that God could have done better. Leibniz concedes that it's not contradictory to think that there could be a world with less suffering for sentient creatures. But that world would not be the best overall world. For humans, it might be better. Or at least for some humans. A world actualized without any evil for humans might be one without any creaturely freedom or it could be a worse one for plant and animal life or life as it extends beyond the temporal. What Leibniz means by the 'best' is with regard to the totality of possibility before God as He creates. Leibniz does not mean best in terms of the best God could do for human comfort. I admit this is tough medicine, but it forces us to confront the latent anthropocentrism by which we often approach the philosophical problem of evil. To avoid Leibniz, I think one must deny his arguments for God's existence, which would entail confronting the PSR. If one agrees with Leibniz's starting points in the conversation about reconciling God and evil, then his conclusions seem to follow reasonably well. I believe Voltaire, Hume, Kant, and other interlocutors up through today fail to sufficiently address Leibnizs' underlying arguments and therefore are not able to truly defeat or undermine the Theodicy. Kant comes the closest, but I believe appropriates and rearranges before changing the conversation more than he does refute Leibniz, at least on the central points at issue.
Christians should do more to leverage the work of Leibniz on the problem of evil. His work is fairly readable and systematic. Leibniz is not the only approach, or even necessarily the best one, to take on the problem of evil and suffering, but I believe he can be a helpful ally.