A soul that has not fulfilled its role completely, and that has even harmed itself and others in the process, is sent back to the world in order to complete the task allotted to it.
If it doesn’t manage to finish its task the second time, it will be sent back again for as many times as it takes.
This return is referred to as a reincarnation, or gilgul.
Although usually a soul is returned to the world for the purpose of completing its unfinished task, occasionally it may be reincarnated for another reason –because either the world in general, or a specific individual, is in need of that particular soul’s contribution.
–Rabbi Adin Steinsaltz