The Simple Answer

Ecclesiastes - Hebrew definition: one who holds and addresses an assembly.  (Preacher or teacher)

The book of Ecclesiastes was written by King Solomon and assigned to be read at the Feast of Tabernacles. This book seems to be Solomon's list of regrets after living his life in materialism and vain glory.  It is a "what not to do" list.

"For in much wisdom is much grief: and he that increaseth knowledge increaseth sorrow." Ecclesiastes 1:18

When Solomon became king, He only asked the Lord for one thing...wisdom. He did not ask for fame, fortune, friends or family. He wanted to be "smart enough" to rule the kingdom and care for his people.

"And God gave Solomon wisdom and understanding exceeding much, and largeness of heart, even as the sand that is on the sea shore."  I Kings 4:29

With the amount of wisdom Solomon received, he became VERY famous. He was wiser than anyone else, he knew all about plant and animal life, he knew over 3,000 proverbs, He wrote 1,005 songs. Kings from every nation on the earth sent scribes and teachers to listen to Solomon speak, so they could learn from him.  

Unfortunately; the fame and fortune brought pride, women and sadly - other gods.  You may ask, "How could Solomon turn from the Lord and worship other gods?"  The simple answer is also his greatest failure. Solomon did not apply spiritual wisdom to his everyday life.

By marrying foreign women he brought on his spiritual ruin. (Foreign means other religions) The Word says not to be unequally yoked and this means do not marry those that are not of the same faith as you.  Solomon had 700 wives and 300 concubines.
"King Solomon, however, loved many foreign (NOT Jewish) women besides Pharaoh's daughter - Moabites, Ammonites, Edomites, Sidonians and Hittites. They were from nations about which the Lord had told the Israelites, "you must not intermarry with them, because they will surely turn your hearts after their gods" Nevertheless, Solomon held fast to them in love." I Kings 11:1-2

The Hebrew definition of Love in this scripture: affection for in a good or bad way. Sexual affection for (lust).

1.  He was not trusting God to keep his kingdom secure. Some of his wives were given to him as "offering" in peace treaties.
2.  He was not able to resist the lust of the flesh (much like David, his father). 

I Kings 11:4-6 shows that these women; did in fact, turn Solomon's heart toward their gods. He did not follow the Lord completely. Like his father, David; Solomon succumbed to the lust of the flesh. Unlike David; Solomon went a step further, into worshipping other gods.

Solomon had asked for wisdom and the Lord gave him more than anyone,  with that wisdom he gained more riches and fame than anyone could ever imagine. But Ecclesiastes is his list of regrets for trading his wisdom for wealth, fame, lust, and other gods. He traded that wisdom for momentary pleasures.

"Get (obtain) wisdom and do not forget it." Proverbs 4:5. In my opinion; Solomon's wisest advice and a subtle warning from a man who learned the hard way about what comes from the pride of life and the lust of the flesh.