Everything comes to an end—sometimes for the best. Disco ended. No one remembers what "Netscape Navigator" was. And Persia's domination of Israel gradually fell apart. That last example happens to be pretty relevant, because it might be what was happening when Ecclesiastes wrote his book.
Yet, with the Persian Empire's rise and decline, things didn't necessarily improve for Israel. Ecclesiastes spends a good deal of time complaining about how fools and wicked people are in positions of power, while righteous people are slaves or among the lowly. This is probably related to the fact that, after Persia started to lose its hold on its empire, people who wanted to take advantage of the situation started to exploit others. Also, he mentions how he's seen people who had gained great fortunes but were never able to enjoy them (because they died or because the fortune disappeared as soon as they'd gained it).
The Persians had helped give Israel new economic opportunities, allowing pretty much everybody to have access to coined money. But this also made it a very unstable time period. People who were rich one day could be poor the next. This world of uncertainty—where everything's up for grabs and nobody can be sure how they'll be eating the next day—really comes through in the way Ecclesiastes portrays the human condition.
P.S. Other scholars think that Ecclesiastes was writing shortly after the Persian Empire gave way to the conquest of Alexander the Great, and the Hellenistic (Greek) Empire—so, sometime after 332 BCE. But the socioeconomic conditions stayed pretty stubbornly the same, so there's no need to adjust your understanding of the setting, even if you decide to "go Greek" with your dating.