When the body dies, the soul proper is released and expands beyond the confines of personality and identity, to join with and become the totality of timeless existence.
What we term heaven or hell simply defines the experience of existence while living; the more giving and selfless the person, the more heaven is experienced, while selfish behavior engenders a living hell for that person. Sometimes the soul can transmute back into existence, as another being on earth or elsewhere.
Sometimes a soul overlaps itself in time, and can even encounter itself with or without awareness. Sometimes an ego becomes so solidified, through will or circumstance, that it forms a spirit that is quite unique from the soul; and when the body passes and the soul is released, the residue of spirit remains.
This spirit sometimes tries to complete unfinished business by influencing physical agents, and rarely it can become a physical agent itself. Often the spirit simply wants to commune with the living, or rectify a situation that occurred while living. Since the spirit, unlike the soul, is ego driven, it likes to attach itself to something connected with it while living; this can be a favorite object or significant place, and commonly it can be a photograph or painting.