The biblical book of Job is one of those books that has made an impact on many people. In the book, Job (a godly man who probably lived the same time as Abraham) is blessed with a family, many possessions, and good health. But because of a Satanic attempt to pull him away from God, all of that is taken away. The hero refuses to curse God as Satan was hoping, but as you would suppose, he does question why it all happened.
Job's experience demonstrates that a believer, while undergoing intense agony, need not renounce God. Question Him, yes; but not deny Him. Like Job, he may long for an explanation of his experience; but being unable to comprehend the cause of his calamity, he need not curse God as Satan had predicted.
The Book of Job also teaches that to ask why, as Job did (3:11-12, 16, 20), is not wrong. But to demand that God answer why, as Job also did (13:22; 19:7; 31:15), is wrong. To insist that God explain one's adversities is inappropriate for it places man above God and challenges God's sovereignty.
Roy B. Zuck, "Job" in The Bible Knowledge Commentary Old Testament, USA: SP Publications, 1989, 715.
Like the book of Habakkuk, the account of Job's experience teaches us that while we don't always know the reason behind suffering, we can still trust God to know and do what is best. Although Job did not understand the reason for his suffering until later, he eventually learned to submit his will to God no matter the circumstances. That is a difficult but wonderful lesson to learn.