if he has attachment with any mansion he may come to live in that mansion as lizard in rebirth etc.
O dear Son of Kunti ! This man attains those-those status what matters he perceive during his death, for the reason that he had leave always with those perceptions. (BhagwatGita: 8/6)
The Lord Krishna is revealing his generosity and sympathy towards human-beings. The human-beings those who have spend his whole life in perusing material desires in strong bonding with mind-body-material cause their rebirth in material world. The human being in ignorance develops strong bonding with mind-body-material on untruth assumption that sovereignty of mind-body-material is everything, sustainable and independent. Which is actually untruth, the mind-body-material and their sovereignty is constantly changing, decaying and moving towards scarcity, causing worry, fear, conflict and never ending blind trap of desires. Since the bonding is based on untruth assumption, the bonding is weak, and human being gets liberated from the bonding whenever he realizes the element of Divine-God. Therefore, even at the time of death if human-being recognize the creator and follow the element of Divine-God, he is wise and start fresh journey in right direction towards truth and sovereignty of Divine-God. Thus he is able to change his course of destiny by remembering and slandering to Divine-God. Human-being even at the time of death has opportunity to seek protection of Divine-God by perceiving happiness in cosmos world.
After death human being attends that state which he perceives at the time of death. The human being perusing element of spirit naturally perceives happiness in divine-world and eventually he attains that. Generally human being perusing materialistic desire will perceive the same for which he is strongly attached at the time of death and invite various possibility of rebirth. If he is pursuing some materialistic mission he may get human body to accomplish his mission, if he has attach with dog, and always feel about dog even at the time of death, in rebirth he may become dog, if he has attachment with any mansion he may come to live in that mansion as lizard in rebirth etc.