This is a good and helpful article by John Starke at the Gospel Coalition on "3 Ways to Think About God and Pain":
A pastor quickly learns that if he stays at a church for even a short while, he'll consistently walk with people through pain. Suffering is never far away from a pastor. Through trial and error, he learns (some of us slowly) what to say and what not say. There are no pat answers. Formulas generally work only on paper, not on people.I have learned that shepherding people through suffering and pain takes more love than pastoral expertise, and often love comes with time. Many times I've been ready with an answer for a question someone didn't have. That's not love. Without speaking for other pastor-flunkies, that impulse usually comes from wanting to be the Savior of the their pain, rather than the one who shares in their pain.
But often the tough questions finally do come. Usually it's not when they first approach me. It's typically after I've been slow to speak, and they can sense my heart is broken with them. From my experience, when people come to pastors concerning their suffering and pain, they're coming with questions. However, those usually come after folks know their pastor loves them; he's slow to speak and quick to mourn with the mourning.
When the questions come, it's clear that not everyone goes through pain the same way. There's not one good answer for questions about God and suffering. People are complex, and so are God's ways. Our answers should reflect that reality.
Nevertheless, I have found three categories of thinking about God and pain that have been helpful as I talk with different people in my church who have been fired from work, learned of their wife's affair, lost their spouse, or endured infertility. These three different ways help us wrap our minds around Romans 8, which teaches that somehow God works all things—whether pain or joy, sword or comfort—for our good.
I say "category" because, again, there are no easy answers to pain. Each instance of pain is different, and each person faces it differently. So use these categories flexibly and with as much love and tenderness as possible.