Passage
Who knoweth the spirit of man, whether it goeth upward, and the spirit of the beast, whether it goeth downward to the earth?
Who knoweth the spirit of man, whether it goeth upward, and the spirit of the beast, whether it goeth downward to the earth?
Ecclesiastes 3:19 For that which befalleth the sons of men befalleth beasts; even one thing befalleth them: as the one dieth, so dieth the other; yea, they have all one breath; and man hath no preeminence above the beasts: for all is vanity.
Ecclesiastes 3:20 All go unto one place; all are of the dust, and all turn to dust again.
Ecclesiastes 3:21 Who knoweth the spirit of man, whether it goeth upward, and the spirit of the beast, whether it goeth downward to the earth?
Ecclesiastes 3:22 Wherefore I saw that there is nothing better, than that a man should rejoice in his works; for that is his portion: for who shall bring him [back] to see what shall be after him?
The verse centers on "Spirit", "knoweth", "whether", "goeth", "upward", and "beast". It is saying that the verse draws attention to "Spirit" and "knoweth", so its meaning should be read from those terms before moving to application.
The nearby context moves from verse 20's "All go unto one place all are..." into verse 22's "Wherefore I saw that there is nothing...", so "Spirit" and "knoweth" belong inside that flow. In Ecclesiastes context, the local focus is covenant, worship, and faithfulness.
A plain takeaway is to answer the verse's own emphasis on "Spirit" and "knoweth" with trust shaped by these words, not by a vague optimism outside the passage.