Material body of living being is often likened with a cage and soul of a living being is likened with a bird. Just as a bird is trapped in a cage likewise soul is trapped in the body.
Through this analogy it is conveyed that once the bird (soul) leaves the cage (body) (after death) and remains in the same room (material world), it would keep getting trapped in one cage or the other. The cage (body) or cage-type (specie) will change but the bird will remain trapped in a cage (material body). Puranik scriptures recommended that the living-entity should break open the window of the material world and enter the world-beyond which signifies eternal realm or spiritual world. After attaining that spiritual world one does not have to return in this material world and one is freed from repeated cycle of birth and death.
In Bhagavad-gita the bona-fide method of getting rid of repeated life and death is explained in detail.
janma karma ca me divyam evam yo vetti tattvatah tyaktva deham punar janma naiti mam eti so ‘rjuna (One who knows the transcendental nature of My appearance and activities does not, upon leaving the body, take his birth again in this material world, but attains My eternal abode, O Arjuna) (Bhagvad-gita 4.9)