If one believes that a person is an energy field that for a while creates a body to live here on earth in, then the disappearance of the body will not mean the dissipation of the energy. That means it may be possible for people to stay connected, although a better term is spirit and not ghost.
When someone believes in ghosts, they are most often referring to a soul or spirit. This soul or spirit is the product of an Earthly death where the entity was unable to move past our world after their death. I find the study of ghosts interesting, however I've never seen solid proof that the phenomenon actually exists.
The 'energy field' hypothesis is illogical. Energy fields cannot be sapient. Don't be absurd.
The 'soul' hypothesis is illogical. There's no evidence for it and there's no explanation of what it actually *is*. People say it's the consciousness; false, the consciousness is a series of electrical pulses in the brain. People say it's the body's energy; false, the body's energy breaks down during decomposition. Don't be absurd.
Of course, this question assumes that ghosts themselves exist. Which also is illogical, as there should be huge numbers of them and they should either be ripped away from the Earth or unable to float / go through things.