After death, the spirit soul is taken to the court of judgment of Yamaraja. And according to his work, he is given a body for his next life. Similarly like someone is working in a company. His service record is maintained. At the end of the year, or at the end of some period, the service record is checked, and he is given promotion or increment. So many things are judged. Similarly, all our activities what we are doing now, that is being recorded. There is record after death. Based on this record, the decision is made by the higher authority – what kind of body we shall get.
One cannot demand that he wants a body of a king or son of a rich man because to take birth in rich family or rich nation, it requires pious activities in their past lives. Everything depends on some cause. Not that by chance anyone becomes very rich man. One has to work for it. Not that by chance one becomes very educated. These things are not chances. So as soon as there is no chance, there is a cause, there must be judgment. Otherwise why one man is born rich and other man is working so hard, but he is lying down on the street? These are laws of karma.
Ref >> Srila Prabhupada Vani.