A secular argument highlights the presence of Persian loan-words (words used in a language from some other language, like 'restaurant' or 'Schadenfraude' in English) to establish the dating and possible sources of the text. What are Persian words doing in an ancient Hebrew text? The Jews have a history of exile and uprootedness. This history began during what is known as the first exile from Israel (or what's known today as Israel) when all the Jews living there were forced to live in Bablyon. This happened roughly 538 to 330 years before Jesus was born. Hebrew writers wouldn't have encountered the Persian language before then. So the secular history of Ecclesiastes is that it was written during this time, not by King Solomon in the 10th century.
For a general idea about what’s going on in this text, imagine working in the tobacco industry for fifty years, building a fortune, and then giving a huge endowment to a lung cancer hospital, making it the most effective treatment center for patients suffering from the effects of a life spent smoking cigarettes.
You might say that founding the lung cancer hospital using the money made from selling tobacco was done 'in vain'. Specifically, your desire to help those with lung cancer was done in vain, because you contributed to the cause of that lung cancer in the first place. It's as though you've done absolutely nothing: causing lung cancer and then trying to eradicate and treat it is much the same as never having done either of these things.
The book of Ecclesiastes is about this kind of vanity. “Vanity” in our times connotes narcissism and superficial self-admiration, but the Biblical meaning has deeper roots in the word 'vanus', meaning 'empty'. A famous line from this hauntingly existential text is that there is nothing new under the sun. Everything has a season. One lesson to learn here is that any attempt to create something new, do something everlasting, or achieve something of substance (e.g, make a fortune and then do philanthropy) is to 'labor after the wind'. Such pursuits are empty pursuits, hubris. For seasons change, time passes, and we find that our thoughts about what's right and wrong, and the actions these justify, are deeply relative, subject to change, and thought in vain
Written by David Backer, Program in Philosophy and Education, Teachers College, Columbia University