The key to understanding the passage you quoted from Ecc 9:5-6 is the small phrase “UNDER THE SUN.” That phrase occurs 29 times in 27 verses in Ecclesiastes. And it only appears in Ecclesiastes.
Jehovah’s Witnesses like to use Ecclesiastes as a proof text concerning soul sleep [that is that once you are dead you know nothing at all]. Ecclesiastes cannot be used for that purpose because it doesn’t deal with anything concerning life after death, only life “under the sun.”
Ecclesiastes doesn’t deal with what happens to your soul after your physical life is terminated on earth. Under the sun, a dead man’s body knows nothing, earns no more rewards, is soon forgotten, and his love, hatred and envy all perish. His portion under the sun is over. It all goes to his heirs, successors and assigns.
His soul, on the other hand, continues to live. If you look in a different passage, the Bible explains what happened to two souls who lived and died during Jesus’ earthly ministry. One man was a beggar named Lazarus [not the one Jesus raised from the dead] and the other was a rich man who refused to help the beggar. All this can be found in Lk 16:19-31. From this passage, you see that before Christ died on the cross, saints went to a place in the heart of the earth called Abraham’s Bosom. It was next to hell but it was separated by a great gulf. The lost went to hell.
Concerning your question, then, you find the following in Lk 16:19-31.
The saved man, Lazarus, and the rich man were both alive after their death. Their souls were alive but their bodies “under the sun” were dead and knew nothing. They had been buried. They could see each other and they recognized each other. As a matter of fact, the rich man in hell recognized Abraham, though they lived nearly 2000 years apart. And the rich man knew that he had five living brothers and that they would join him in hell if they didn’t get saved. So, he knew plenty concerning his life here on earth and even concerning some things that he didn’t know while he was alive “under the sun.”
Concerning whether the dead know what’s going on in the earth after their bodies die “under the sun,” Samuel knew what would happen to the kingdom, to Israel, and to Saul and his sons [1 Sam 28:15-19] and the souls under the altar knew that they had not yet been avenged by the Lord [Rev 6:9]. So, evidently, at least some know what’s going on here.
Hope this helps,
Pastor Bevans Welder