I often think about this; it's the sort of thing that keeps me awake at night.
I don't pretend to have all the answers, but trust that God IS love and that He has a plan. The Bible says:
'I will rejoice over Jerusalem and take delight in my people; the sound of weeping and of crying will be heard in it no more. Never again will there be in it an infant who lives but a few days or an old man who does not live out his years...The wolf and the lamb will feed together, and the lion will eat straw like the ox'.
C.S. Lewis wrestled with the same question. In 'Mere Christianity' he wrote:
'My argument against God was that the universe seemed so cruel and unjust. But how had I got this idea of just and unjust? A man does not call a line crooked unless he has some idea of a straight line. What was I comparing this universe with when I called it unjust?'. He concluded 'If I find in myself a desire which no experience in this world can satisfy, the most probable explanation is that I was made for another world'.
John Wyatt writes on the subject:
'The mysterious and wonderful truth is that we don’t get an explanation about the nature of suffering and evil. Instead God in the person of Jesus enters into the experience of suffering himself.
God himself enters into the experience of dependence – he becomes a pathetic fragile baby, he can do absolutely nothing for himself, he needs to be fed, to be kept warm, to have his bottom wiped, and at the end of his life on the cross with hands nailed to the wood he is again utterly dependent and through parched lips he croaks, I am thirsty,
The God whom Jesus reveals is a God who weeps at the graveside of Lazarus, a God who is deeply moved at the suffering of a widow in the town of Nain who had lost her only son, and a God who takes the suffering of the world into himself on the cross'.
Charles Dickens once said, "Suffering has been stronger than all other teaching...I have been bent and broken, but - I hope - into a better shape".
(Apologies for the length of post!).