There are many beliefs out there what survives after death, and what happens to us. They are so vast, yet they do have similarities to each other which are fascinating.
Hinduism believes we have a jiva, and this is like a divine spark within us. When it becomes free from doing various work, this becomes the transcendental atman and this atman survives death. In Gnosticism, they believe that light became trapped in matter, and within us is a divine spark, and it is about releasing these sparks, through uncovering the darkness within and realizing the light, one can go on. In Kabbalah, there is also a divine spark, and what we do is discover our spark, and also work at releasing the spark in others to bring light into the world, so we can go on.
Buddhism is more unique in that they believe in rebirth and it is not a spark or jiva but a 'stream of consciousness,' which goes on, but not the self, which is very different. This aspect is the one subject to birth and rebirth until nirvana is achieved.
Christianity describes having a soul, not as much a spark but a soul, and one can go on to a heaven or hell depending on if they are saved. They do not address much about the ego, but they do address that one can 'die to self be born to life,' which seems to imply a death of the ego.
Much of hinduism seems to imply a death of the ego is necessary. Sufism implies death of the ego, to merge with the beloved. Buddhism is the ego is false and unreal to begin with. Kabbalah and Gnosticism pretty much address it that one must shine light in the darkness.
Kabbalah and Hinduism have their own sense of a permanent self, in Kabbalah it is the Adam Kamon, in Hinduism it is the Atman.
Buddhism does not subscribe to any permanent self at all. And explains life that look at a flame lighting one candlestick to candlestick. The stream of consciousness is transferred, but a 'self' is not transfered.
So ultimately, one works on the path very hard and reaches a point, that they realize the ego is not going to go on. That ego is merely a construct, created by various things, which are basically a byproduct of thoughts and emotions. The trap is believing this goes on. The problem is what must be focused on, is what truly goes on, and how can I get that which goes on in the right place for myself.
Some say we may come back in the human realm. However, some do not desire this. So my prediction, is you should decide what you want your essence, however you wish to call it, to go on. Then choose a path which serves that, and develop yourself so you can move on.
Then Castanedas books elude to the Double. The double, DJ says, is the self. The double we create, but then we find, the double was creating us all along. This, ultimately is what can survive at the third attention when we die. We have the ability to wake up in the double in dreaming, and explore worlds doing so. This is one way of transferring our essence.
So all these mentions something transfers. But even Christians may be mistaken, as they think ego is going to go on. Even if you read deeper, die to self and born to life. So even if one goes to a heaven, the ego is going to lose consciousness, because the ego is part of the world.
Then one could say what about ghosts? One of the things with ghosts is they are trapped. They are part of the world, and they have some ego flux, kind of residue, but they did not develop their essence, and basically refused the light when it was time to go. This is why it is important to let go of attachments, develop your essence, so you do not get stuck. It is much worse to be stuck, then achieve a new life. AND it could be they saw they had to come back, no. And refused it. But this is a horrible way to exist, it would be like living in a nightmare.
Ultimately I cannot give a grand answer of what 'exactly it is' that transfers. Like, how do you describe the spark, or a stream of consciousness? All of them seem to have a unique stance on being free. They all require work. Don't be fooled by the Christian premise. One of the things Jesus warns in the Bible, is people will come to him, and he will not know them. so just saying you want to be saved and the sinner prayer is not going to do it> It only makes sense one has to make changes in their life, and work at being a decent person, to be able to survive life in any form. It is foolish to think you could be saved, but you stay a sinner. This is definitely something many are misguided on, and hopefully many will see the light on this.
There are many resources to explore, but it is fascinating when we do examine the similarities and differences of these ways. I cant offer much on this, but I can offer we do have a glimmer of hope, however, our ego, which is a construct of thoughts and emotions, does not go on.
One would have to develop their 'higher consciousness' and develop this, for it to go on. But the little self, does not go on.