Praise be to Allah, and peace and blessings be upon the Messenger of Allah and his family.
When a person dies, he moves from this world to another realm, and his soul does not come back to his family and they do not feel anything of him.
What is mentioned (in the question) about the soul coming back for forty days is a myth that has no foundation.
Similarly the dead person does not know anything about the circumstances of his family, because he is absent from them, in a state of bliss or torment, but Allah may inform some of the dead of some of the circumstances of their families, but this is not necessarily so.
There are some reports, which cannot be relied upon, that say that the deceased may know something about his family’s circumstances.
With regard to dreams, some of them are true and some are the playing of the devil.
The living may come to know something of the circumstances of the dead via true dreams, but that depends on the sincerity of the one who sees the dream, whether the dream is a true dream and the ability of the one who interprets these dreams.
Yet despite that we should not be certain of what the dream says, unless there is some evidence to indicate that. For a living person may see his deceased relative in a dream, advising him to do things or saying some things to him which he may know are true if they match reality.
There have been some cases in which dreams matched reality and others where there is no evidence to suggest that the dreams are true. And some dreams are known to be untrue. So dreams are of three types.
We must pay attention to that when dealing with news, reports and stories that have to do with the circumstances of the dead.
For more details, please see the following answers: 20820 , 147920 , 34361 , and 200530 .
And Allah knows best.