For a long time I have been rather contemptuous at attempts of theodicy. This is because most of the attempts make a mockery out of some deeply important matter or they somehow undermine exactly what they were trying to defend.
But there is one answer that I have found which seems to do a fairly good job at it without causing any serious metaphysical casualties. This would be Leibniz's "best of all possible worlds" solution. In it, God is constrained based on the inherent nature of the world He's creating to balance opposing values and in God's mathematics there is a required minimum of evil that must exist in order for the world to be possible. Indeed, perhaps at each moment, God is doing His divine calculus and selecting (perhaps through being the ultimate observer in Quantum Physics) the world with the least amount of evil in it.
The focus point where this argument seems to depend on is that God is not as omnipotent as previously thought. For if He's constricted by the nature of the universe then He cannot do 'anything.' But this is an old issue and is really as relevant as God not being able to create a rock that He cannot lift. It is a logical impossibility. So too, it is simply a logical impossibility to create a world desired by God without some evil in it.
As JA relates a counterargument, "But doesn’t that limit God’s knowledge and power? Doesn’t that say that God couldn’t think of a better way to accomplish his goals other than torturing innocent people?"
The answer is, as explained above, yes, it is a limit of sorts on God's power. And no, there is no better way.
It is rather easy for us in our limited perspectives to scoff at this and say how simple it might be to change this or that little detail and make the world a much better place - thus undermining the whole concept that the world is already the best. For example, mightn't the world be a much better place if God gave Hitler a heart attack in his youth? But the truth of the matter is that we have no idea if the world would, in fact, be any better. It could be much worse.
If you've ever seen any of those movies like the Butterfly Effect or famous Twilight Zone episodes (or even that one from the Simpsons) where people who think they're being clever travel back in time to fix something that went wrong in the past, they never appreciate the intricacies of the timeline and inevitably only manage to make things worse (Dr. Sam Becket, notwithstanding). The point is that it's easy to say that something could be made better with some little change here or there, but without the absolute perspective - which only God can have - such notions are due to mere ignorance.
A good article on the topic: here.