This is one of the great questions throughout the ages.
One of the shortest verses in the bible relays that “Jesus wept”. The biblical answer to this question is that the world is a fallen place and is moaning in the birth pains of a fallen world. Look at Romans chapter 8. God allows the world to be a fallen place and good things happen to both the believer and non-believer alike just as horrible things happen to the believer and non-believer alike.
Oftentimes, a tragic event in the life of a non-believer will sometimes bring that person to the true God. Likewise, a horrible event in the life of an existing Christian will sometimes embolden their faith and help win more people to the saving power of Jesus Christ.
I do not have all of the answers. I have seen wondeful things happen to people that I would not consider “good”. I have seen riches go to people that are secular and never seek after God. I have witnessed little babies and toddlers with Christian parents that end up with a deadly disease and end up passing away.
The question of evil and how different people respond to it really shapes their worldview. I believe that many atheists are not believers more so because of the question of evil than lack of proof of an allmighty God. Rational people realize the fine tuning of the universe along with the creation of the first cell and DNA did not happen by random chance. Instead, they wrestle with the Father figure of God and why would he do this or that to them or other people in their life.
As a Christian, even though I know we have very good and mature answers to the question of evil in the bible and throughout the religious letters of the millenia … I still struggle with evil. I do not subscribe to the philosophy that Satan does it all – read about how Jesus discussed the falling tower that killed men that were not worse than other men in Jerusalem (Luke chapter 13).
We are given free will and as humans we have created an environment and societies that allow evil to happen to the righteous and the unrighteous alike. This helps in our understanding of how people are influenced by our Godless society and commit horrible atrocities but it does not exactly explain why a 1 year old baby gets cancer.