"There is something else meaningless that occurs on the earth: righteous men who get what the wicked deserve, and wicked men who get what the righteous deserve. This too, I say, is meaningless." NIV translation
Solomon came to realize that life on this earth is not fair. It would seem that God's people should be the richest people on the earth and yet, even today, those who lie and cheat seem to get ahead of those who don't. In the end, the earthly riches will not matter and so chasing them is worthless.
"So I commend the enjoyment of life, because nothing is better for a man under the sun than to eat and drink and be glad. Then joy will accompany him in his work all the days of the life God has given him under the sun." NIV translation
Solomon advises us to enjoy what the Lord has given each of us and to not worry about what someone else has.
This is contentment and it seems like it is the opposite of the way the world works today as everyone is trying to climb the ladder of success.
Most do so without any joy and they seem to be the most miserable of people.
"When I applied my mind to know wisdom and to observe man's labor on earth - his eyes not seeing sleep day or night - then I saw all that God has done. No one can comprehend what goes on under the sun. Despite all his efforts to search it out, man cannot discover its meaning. Even if a wise man claims he knows, he cannot really comprehend it." NIV translation
God had granted this man greater wisdom than anyone else will ever have and yet he realized that his wisdom had limits. He still could not understand everything that God had done. It is the same with us as we continue to grow in our faith and understanding of what God has done for us.