v1-3: The reality of death challenges all religion. Why be righteous and do good? Why sacrifice? But true religion goes beyond the grave, and death has been defeated. The writer repeats himself, "one thing happens to all," whether righteous or wicked.
v4: The Pariah dog (scavenger) was despised, contrasted with the lion, the king of beasts. Yet life brings hope, even to the despised, see 4.2.
v5-6: For the preacher, death meant the absence of all feeling and emotion and memory. Death does not join a person to his/her ancestors; human relationships end at death, Matt 22.30.
v7-8: The joy of life. The happy Jews wore white robes and had anointed heads; here is the joy of a justified life.
v9-12: Death us a certainty, therefore live well, enjoying marriage and work. Under the sun there is injustice, and "time and chance," for we all suffer life's problems and hardships; 3.1-8 present a similar thought. Death comes suddenly and unexpectedly. For the Christian, these verses encourage fresh dependence upon God.
Yet the conclusion, at face value, is wrong. It restricts itself to this world, to life 'under the sun.' We need to have an eternal perspective, that Christ will put right all the wrongs - and open the new heavens and new earth in which righteousness dwells (2 Pet 3.13).
v13-16: Again we see that life is unfair, the good man who delivered a city is quickly forgotten. Commentators suggest that Solomon is recalling an incident known to him and perhaps to his readers. The 'hero' of the story is forgotten and returns to obscurity. Such is the unfairness of life.
The deliverer can be easily forgotten; how sad when professing Christians forget Christ, their deliverer, and seek to live without a real commitment to Him.
Wisdom is still preferable, even when it is not acknowledged as such. 'A little subtleness is better than a lot of force.' (Zaire Proverb)
v17: Wise words, spoken quietly, seeking no glory for oneself; different to the shout of the ruler, drawing attention to himself.
v18: The power of wisdom to bring deliverance and victory, "better" relates to God's opinion rather than human popularity.