This has to do with the concept of rebirth... If you wanna believe in a test that leads you to heaven and hell, you have the trust the guy who tells you you must believe just in case. However, if you wanna believe in rebirth you can trust the thousands if not millions who will tell you I've seen it myself. I will not share my opinion on this. But here's the fun part of how it works
When the body dies, the karma and a bunch of stuff remain(karma is not a justice system as the west thinks, it's just your recorded history of all impressions that you gathered. And yes it does bite you in the ass if you are naughty, so maybe that's where it came from.) anyway based on this history of deep unfulfilled desires and emotions you choose your next body based on the surrounding impressions of the parents and maybe the general vibe i guess... So you do choose. But its more like you're attracted to... Not choosing because your mind is dead now. Only memory remains. They say it follows the "smell" of what is suitable to it.
They say an advanced yogi or a seeker who is not advanced enough to choose a new body consciously. will likely be the child of a yogi... BUT and. Big BUT here... He may instead be very rich or powerful or WHATEVER HIS HEART TRULY DESIRES AND HIS EMOTIONS ARE MOST ATTRACTED TO. So he may say yeah my deepest desire is enlightenment... But wakes up with a lot of money the next life... Well that's what you wanted asshole.
So why are some people born in miserable conditions... I did not study the karmic system well enough. But i know everyone gets what they're really attracted to. Happiness or misery... Very hard to control sometimes. But if everyone got to consciously choose they'd all be happy. But they don't, they follow the smell they're attracted to.
Thank you❤️