After the Irish Potato Famine that George Boole lived through, he worked on a paper named "Origin of Evil".
His conclusion was: Absolute evil does not exist and pain is an instrument of good.
I can't find it online, my source is the documentary "The Genius of George Boole" [1].
Kierkegaard's The Sickness unto Death [2] could be a related reading too. I remember that I enjoyed it in a fun way.
Also a dumb theory of mine is: suffering is the proof that you are still alive.