One must look at these things from different angles, and then you can glimpse other possibilities that you never could. There is also time, that it takes time to make sense or turn bad to good.
There is also the fact that suffering can bring great works and end up doing great things. Eric Clapton is always said to be the one left behind to play the blues created by tragedies. He would never have been able to create those things otherwise.
Thomas Edison is said to have been inspired to create the light bulb, when he was young, the doctor who was operating on his mother on the dining room table, had to tell him that he did not need to continue looking for more candles to help the doctor see what he was doing , since she had just died.
I have been taught to be more sympathetic towards those who are downtrodden by experiencing it myself, also the way we learn is through failure, and there is no other way most of the time.
There is the story of Dogface, who is now Saint Christopher. He was born as an extremely handsome man, and he saw as he reached adulthood , that he was too easily tempted and treated better than his fellow, simply because of his looks. So he asked God to give him the face of a dog because he loved God so much that he knew he would never be all he wanted as a Christian with everyone treating him better than others because he was so attractive to women and men.
So God granted his wish and he ended up as a saint.
Those who never experience pain can never understand, those who are rich , in money or good looks and talent,also cannot understand the plight of others less blessed because they are treated different.
Those who have worn a fat suit to make them look like a fat person cannot believe how they were treated while they had the suit on.
So those who suffer are also wiser for it. Your mother also probably told you would thank her for punishing you now, but you never understand that she was right until decades later.
In Alcoholics Anonymous they are taught to believe that they have to admit they are incapable of controlling what happens in your life, and when you think that you are responsible for all that goes in your life, you end up a mess, because not everyone can be a success all the time, and things happen that we cannot control. By teaching to believe in a "Higher power", They have helped more people overcome thier problems more than any other since they started 80 years ago.
Of course there is also pure evil and things which are sickening and useless. But there will never be anyone who can make sense of it, or any science to explain some things, no matter how you try.
Only through faith can you overcome these things.