This question has disturbed sages and scholars for centuries.  There are varying responses.

One is that God who created all things, also created good and evil.  The purpose was that God gave then humans free will…the ability to choose between doing good and doing evil.  In the book of

Deuteronomy. God says, “Behold, I set before you the blessing and the curse, the good and the bad, life and death.”  In other words, the choice of how one lives is up to the individual.  If one chooses good, then there is a blessing and a meaningful life.  If one chooses to do bad, then the consequence is to be cursed and an-earth like existence.  However, God being a compassionate and caring God, like a good Father, suggests, “Choose life,” meaning to choose to live a blessed and meaningful life.   In the book of Deuteronomy there are many teachings which say, “If you listen to My commandments, then I (God) will be with you, and if you do not obey Me, then bad things will happen.”

But the reality is that  good people do suffer and evil people seem to prosper.  So there is an anomaly between what the Bible teaches and what happens in life.

The early sages justified this variance by stating that the righteous who suffer in this world will enjoy life eternal not suffer punishment in the hereafter, while the souls of the wicked will suffer punishment or have their souls blotted out.

The book of Job deals with this question.  It tells the story of Job who is a righteous man and is put to the test – to see if he would still retain his faith God were bad things to happen to him.  His friends suggest that his suffering is due to his sinning.  Job insists that he is innocent.  While the book of Job indicates that that at that time punishment was the price for sinning, the book also indicates that  human suffering is not due to one’s  sinning.  The book of Job also teaches that even in the face of suffering, one must keep faith in God.

The Zohar which is the text for the Kabbalist movement does not address the question of the good suffering and the wicked prospering in a clear way.  It does teach that the righteous who study Torah and live by its teachings will be rewarded while those nwho reject the Torah and the laws will be punished.

As I see the various teachings on the subject, I conclude that Judaism today is reminding us that we are responsible for the consequences of our actions.  My view is that God purposely created an imperfect world ands made human beings also imperfect.  The reason was that we humans should not be robots,  but that we, created in God’s image, are partners with God in the acts of creation and have the duty to make this a better world as well as to make us better human beings.  I do not believe that God punishes us for every little shortcoming.  We punish ourselves.

This leads me to my views about the Holocaust.   I do not blame God for allowing the holocaust.  The holocaust was the fault of humans who were inhuman.  If God stepped in every time that  there was a war or a crime, then we would never learn to pursue the path of righteousness.  We would always rely on God.  When we pray to bring peace to the world,  we are actually praying that God inspire us to work for peace.

I hope that this information will help you.  If you have time, get on line with the heading “Judaism’s View on why the good suffer and the wicked prosper .”