As Jim West put it, this is very long but worth reading.
... In fact, the Book of Job perhaps serves more as a critique of theodicy than a source of theodicy. Eliphaz, Bildad and Zophar defended God’s justice, often with very logical arguments and sensible reasoning, and yet God said of them in the end, “you have not spoken of me what is right, as my servant Job has.” (42:7 ESV). How can it be that the one with no answer to his own suffering is commended, while those with the best theodicies are under wrath? Let the arguments of Job’s three friends first be considered.
Dave Jenkins continues:
Eliphaz, the first to speak, offers a very simple hypothesis: “who that was innocent ever perished?” (4:7). Because Job is suffering, Eliphaz suggests he must have sinned; thus Job himself is responsible for his own pain. This argument treats suffering as punishment and blames human freewill (as opposed to God) for evil; it would likely have resonated well with a Hebrew audience. However, not only does Eliphaz oversimplify the problem, but he becomes increasingly arrogant in arguing. [emphasis mine] He begins gently and obliquely- only indirectly referring to Job- but by his third speech, he does not hesitate to hurl insults and directly accuse him of specific sins. Moreover, Eliphaz implies that he is somehow a prophet who has heard God’s voice and now speaks on His behalf (15:8, 22:22). Therefore, while Eliphaz offers what may seem like a decent theodicy, his ignorance is clear by the end of the book, and even worse, he does nothing to comfort his friend in need. [emphasis mine]
Of the next friend ... :
Bildad also offers a theodicy: “Does God pervert justice?” (8:3). His argument is very pragmatic, insisting that if Job repents, God will restore his fortune; he even uses examples of history to demonstrate his point (8:8-19). However, as Job maintains his integrity, Bildad’s language intensifies. Certainly the idea that suffering may serve as a “wake up call” is valid; even Jesus uses examples of suffering to call people to repentance (Luke 13:1-5). However, Bildad commits a logical fallacy by assuming that this is necessarily the case with Job, and again, the limits of his theodicy become evident.
Of the third and of the approach of the three, Jenkins observes:
God appears at length and reveals that He is above the examination of any human achievement or enquiry. While this can be seen to show that Job is unable to secure an answer or explanation for why he has suffered this is also true of Job's friends.
If one is to use this lens, then to examine the earlier speeches of Eliphaz, Bildad and Zophar, it becomes evident why the Lord accuses them of speaking falsely- they boast of knowledge and understanding, yet they do not truly know. Furthermore, they hide behind their arguments as a means of avoiding the true responsibility of a friend: comforting the one who suffers.
Surely, the Lord’s speech to Job could be used to construct a theodicy based upon the sovereignty of God; the clay has no right to question its potter, one might remark (cf. Romans 9:20-21). Yet it would be foolish to take this argument and use it to escape the command to “weep with those who weep” (Romans 12:15 ESV). It was the three friends’ obsession with theodicy that rendered them “miserable comforters” to Job (16:2). This tendency to reduce evil and suffering to a purely rational problem—especially a problem to which one claims to possess the solution—is exactly that which the Book of Job criticizes. [emphasis mine]
Now one of the most common interpretive moves I have heard people attempt to make regarding Job's speech is to say that he ended up being proud and sinful. The problem is that this case has to actually be proven. As God Himself declared Job blameless at the outset in order to find fault in Job's words or actions necessitates that we agree with Satan, which is a problematic interpretive move to make for reasons that should be self-evident. Jenkins puts it this way.
Satan’s predictions do not come true as Job did not sin. However impious and shocking some of the statements Job makes during the dialogue may seem to us, his transgression of the conventional bounds of decorous religious talk might incur the disapprobation of the cautiously reverent men, but the only censure they receive from God is that Job obscured the divine purpose by talking in ignorance (Job 38:2).
As a critique of theodicy itself Job may be a book that will not regularly be preached. It's a book of guys arguing about stuff. Very little happens in the book beyond the initial explosion of activity in the wake of Satan's bet with God. If I were to suggest a simple, and arguably too simple, reason pastors have not done ten year expository sermons on Job the way some have with Romans is because many pastors want to preach and teach in a way in which one propositional statement leads inexorably to another and practical application becomes possible. The book of Job so resolutely resists and subverts this approach that the book virtually compels a topical approach. This should not prove any great surprise since a singular topic drives the conflict and narrative of the book.
Within the realm of canonical wisdom literature Job can be seen as a personalize case study of the essential problem of reading proverbs as promises or as laws of divine favor and rebuke. Attempts to transform the death and misery of others into theodicy is itself a thing in Job that God Himself rebukes. Does this mean there's no place for theodicy? Well, obviously not, but it does suggest that as a friend of mine put it so succinctly a few years ago, the book of Job is a warning to us that the right theology applied to the wrong person at the wrong time for the wrong reason can still end up being false words about the Lord. If we don't grasp that this is possible well, maybe the book of Job is for us. In any event the book of Job is a compelling and fascinating read. If you haven't read it in a while give it a visit. This will eventually lead back to some musings on Ecclesiastes. It's possible to make a case that where the book of Job questions theodicy while affirming God's faithfulness and the beauty of what God has made, Ecclesiastes expresses skepticism even about the goodness of what God has made. That will be something to discuss later and Ecclesiastes being the sort of book it is, can invite some debate. I'm not a professional biblical scholar so I'm not going to pretend to have more than an interested lay-person's knowledge and fondness for the topic.