(This article is adapted from my 2021 book Thinking About Good and Evil.)
Traditionally, the Book of Ecclesiastes is read publicly in the synagogue on the intermediate Shabbat of Sukkot. In years when there is no intermediate Shabbat, the reading is scheduled for Shemini Atzeret. The provenance of the book is still debated by scholars but its focus on good and evil is compelling.
Because good men die prematurely and evil men live long, the author of Ecclesiastes reasons that there is no point in excessive righteousness, since goodness does not assure longevity (Ecclesiastes 7:15–16). Further, the author observes that there seems to be no justice in the world. The well-known apothegm that “the righteous will be rewarded and the wicked punished” is challenged by the reality that the wicked prosper with equanimity (8:10–14). Sometimes the wicked are never punished at all. Sometimes God may punish evildoers, but the retribution arrives too late for it to be meaningful.
It is not surprising, then, that people believe there is no divine justice at all. As the preeminent medieval exegete RaShI comments on Ecclesiastes 8:10: “Humanity thinks there is neither judgment nor Judge because God does not rush to punish evildoers.” Ultimately death claims both the righteous and the wicked alike, again making divine providence inscrutable (9:1–3).
However, the author of Ecclesiastes neither believes nor accepts the idea that evil will always triumph. Otherwise, as Professor Robert Gordis points out (Koheleth – The Man and His World, p. 227), he would not have advised against a life of evildoing. The author is careful to note that some upright men suffer the same fate as scoundrels (8:14). And while the author acknowledges that sometimes punishment is delayed, he maintains that as a rule, God effects retribution against evildoers (8:11-12). Indeed, early on (2:26), the author affirms divine justice and confirms the teaching of Psalms 37 and 73 as well as Proverbs 13:22 and 28:8, satisfied that whatever fortunes the wicked may amass will be handed over to the righteous.
The moral anomaly of why the wicked prosper and the righteous do not remains logically insoluble. In this the author of Ecclesiastes is in league with the psalmist. Yet, concomitantly, the author of Ecclesiastes fully expects that divine justice will prevail.
It is a worthy expectation.