I take comfort in the Bible passage: "Now we see through a glass darkly, but then face to face." I have a list of questions that are unanswerable now. All I ask to take with me from this earthly life is the love I have known and that list so that I can get all those questions cleared up.
In "Fiddler on the Roof" Tevia demonstrates the Biblical admonition to 'pray without ceasing' as he has long conversations with God as he goes around his daily tasks. But even he, devout to the last, but when things were at their worst, he had to question God 'why?' He didn't see it as him being punished. It was those unexplained things that only God knows why.
I think the deeper message of the ancient scriptures is that God does not will bad things to happen to us. But he gave us free will so that we could know his love. That free will also allows us to sin and it is the cumulative sins of humankind that has spoiled God's perfect Creation. Sin is bad because it hurts the sinner and also the innocent whether by sins of commission or omission. Sin has consequences even 'unto the fourth and fifth generations.'
I think that's the way we should look at it and be like Job. No matter how bad it gets we do not curse God and die. And this too shall pass, God will get us through it, and it will be but a fleeting memory in the whole of eternity.