Let me elaborate on the occult view. When a child is born it not only has a small, undeveloped Physical Body (Annamaya Kosa) but a small Astral/Vital Body (Prnamaya Kosa) and a small Mental Body (Manomaya Kosa) as well. Astral Body is the body of desires and emotions, and Mental Body is body of thoughts and higher feelings. Astral Body remains in Astral Plane (of Consciousness) and Mental Body remains in the Mental Plane just like the Physical Body remains in the Physical Plane. These planes are higher dimensions invisible to naked physical eye but visible to eyesight proper to those dimensions. The Soul uses the Physical Body, Astral Body and Mental Body to gather experiences on the respective planes. A part of the Astral and Mental Bodies penetrate and envelop the Physical Body and are integrated in the Physical Body. Astral Body thus integrating into the Physical body is what keeps the body alive to the stimuli of desires which is otherwise a dead piece of stone. And Mental Body integrating into the Physical Body is what makes the body receptive to thoughts which is otherwise a simple animal. Now as the child feeds on food it's Physical Body grows, and as it 'feeds' on desires it's Astral Body grows and as it 'feeds' on thoughts it's Mental Body grows.
One clarification. The Physical Body (Annamaya Kosa) has two parts, one called the Gross Physical Body (Sthula Deha), the body we are conscious of, and the other Subtle Physical Body (Sukshma Deha).
When the Physical Body grows old and decrepit, the Soul withdraws the Mental, Astral and the Subtle Physical Bodies from it and the man 'dies' rendering the Gross Physical Body a lifeless 'stone'. The person now identifies himself with the Subtle Physical Body which hovers above the dead Gross Body. Under normal conditions the person remains asleep in the Subtle Body which disintegrates after a week or ten days (2nd death). Now the man awakens in the Astral Body on the Astral Plane and lingers there till the Astral Body itself dies when all the vibs of desires and emotions die out. This is his 3rd death. Next he finds himself identified with the Mental Body till it dies when thoughts and feelings die out ( 4th death). Then only he discovers himself to be the True Person he always was, the Soul. And as Soul he retires to the Soul world for assimilation of the experiences he had. After a long rest the Soul dives down, gathers a small Mental Body, then a small Astral Body and a Physical Body. Lo Mike is now born again as James or Dinesh. So after death a man still has all the desires and emotions, thoughts and feelings, only much more intense till eventually they all die out. The emotions and thoughts bcome more intense after death as there is no Physical Body to deaden their intensity. The principle of the Physical Body is inertia and hence insensivity. So while alive on earth the Physical Body tends to impart its insensitivity to the feelings and thoughts and hence deaden their intensity.
In each incarnation the Soul puts forth a Mental-Vital-Physical personality to gain experience of the world and grow by it. The essence of the experience is stored in the Soul as instinct. Thus a poet who writes of courage of a warrior, even though he himself never held a sword, must had been a warrior in some former birth. He doe's not remember the exact circumstances as that former personality that experienced is now dissolved. A warrior develops courage, vitality in one birth and the Soul may use that courage and energy in fighting environmental issues in another life with a suitable personality. Or he may be reborn as a businessman so he learns organising skills. What is the use of Mike remaining as Mike for ever. The Soul grows and gradually learns to master the outer personality which is actually a product of Nature as opposed to the Soul which is a product of Spirit.
All I've written is the normal course of life after death. Apart from the first death all other ‘deaths' will be painless. Only danger lies while the Soul travels through what could be called ‘lower’ parts of the Astral plane, where our lower emotions like lust, anger, greed, hatred, fear etc are being worked out. But each Soul's journey will be unique and subjective.
But there are certain abnormal circumstances like early death, the Soul does not go through the normal course of shedding the Astral and Mental Bodies, but keeps the same old, but still energetic, Astral and Mental Bodies. Then in the matter of a week or two, the Soul will enter, whatever soon-to-be-born baby-body available, and takes rebirth, to work out the remaining part of the destined lifespan. The baby-body could be that of a begger's or a prince's, male or female, depending on luck, There's no escape even from suicide. Owing to bad luck, if there's a mismatch of gender while taking up a new body, the person ends up being born a ‘third gender’. That's for ex, a man committing suicide finds only a baby girl to enter, he'll be born a ‘third gender’.
However if the early death was already due to working out of the remaining years of an even earlier death, then the person will go through the normal course I've described above. Suppose a man with sufficient vitality to last for 70yrs dies at 40, say due to accident or suicide, and immediately takes up a new Physical Body but still keeping the old Astral and Mental Bodies, he'll have another 30 yrs of vitality left, after which he'll die. But this time he'll go through the normal course of shedding his Astral and Mental Bodies before ending up at the Soul world.
It's normally in the case of early death and rebirth, the child often remembers past life, how he died etc, owing to the fact he still retains his old Astral and Mental Bodies along with their memories.
Some times a person dies, experiences going through a tunnel, sees some light, which sends him back, and the person wakes up from apparent death. This ‘tunnel and light' is not experienced in the normal course. It happens only in cases where the destined hour of death has not yet come, but still somehow the person experiences death, when a higher power, probably his Soul, intervenes and sends him back.