Solomon does this by first pointing out that there is nothing new under the sun. In other words, what is seen today has always been, and will always continue to be as long as the earth is in existence. The sun rises and the sun sets. The wind blows, the rivers flow to the sea, and generations come and go. Life has continued as such since the beginning.
Solomon points out that nothing in life is in and of itself original, new or unique, and therefore holds nothing to capture the attention of a seeker. Nor are they the meaning of life, since someday everything will come to an end. So the next place to look is within humanity itself, the one for whom all of what is seen was created.
But for those who think that human intellect is the answer, Solomon retorts that even this is futile. There are many things in life to be learned and discovered, but with increased knowledge comes increased sorrow. (Ecclesiastes 1:18) The more one learns about life, the more injustices they discover that cannot be fixed. Human wisdom is fallible and unpredictable. It cannot right the wrongs of humanity, nor can it provide what is missing in life. It is like trying to catch the wind with a fist; it is useless and to seek after it is a waste of time and effort.
Likewise, Solomon says that other things like pleasure, popularity, materialism, and the like are all temporal and useless. They only satisfy for the moment, accomplishing nothing. Many people work long and hard to obtain such things, yet it is all in vain. They offer no lasting benefit; they come and go like the wind and do not add a single day to the lives of those who pursue them.
Solomon also concluded that both the wise and the foolish face the same end. One who stumbles in the dark dies just as the one who walks with eyes wide open; both are subject to the same demise in the end. So retribution in this life is not the answer. Neither social status, nor intelligence, nor even wealth or reputation can protect someone from what is inevitable for all.
Interestingly, all of the insights that Solomon provides in the book of Ecclesiastes are not so much what the meaning of life is, but rather what it is not. Through a series of deductions, one by one the things that seem important are labeled as nothing but vanity, or empty and fleeting. But in the end, the conclusion that Solomon comes to is simple: Fear God and keep His commandments. (Ecclesiastes 12:13)
Solomon states that this is man's all. In other words, it is here that the meaning of life is found. A relationship with God is what will stand when He comes to judge the earth. And a relationship with God is the one thing that should be valued above all else. After Solomon's quest, the summary of everything he found was that a person's desires and purposes should lie not in the things of this life but in God alone.