Solomon is speaking as a man who literally had an abundance of everything. The wisest, richest, most powerful, most respected, most famous person of his time had a thousand women at his beck and call, and was miserable.
His search for happiness and fulfillment apart from God could not be found no matter how hard he tried or how much money he spent. Much of the wisdom he spoke came from a dark place in his life.
That being said, there is much we can learn from the king’s experience.
Things about worship: “Guard your steps when you go to the house of God.” (5:1) Approach God in obedience, don’t be hasty to speak, don’t promise God something you can’t fulfill.
Things about wealth: use what you have to help the poor, don’t allow gaining wealth prevent you from enjoying what you have, live a balanced life with both work and rest.
Things about wisdom: pursue it, but don’t accept everything you hear. Know the difference between wise and foolish counsel by knowing God.
Yes, Solomon was in a dark place when he wrote this book. Scripture tells us that toward the end of his life he actually began worshiping the pretend gods of his foreign wives.
Let this be a warning. And let Solomon’s experience and his questions encourage us to “guard our steps” as we approach God, as we protect our walk with our Savior. Because the further we get from Him, the darker our world becomes.