The belief that God created and sustains the world is a foundation of faith. Were He to stop infusing the world with life, even momentarily, it would cease to be. God also gave human beings free will. If a person chooses good, he draws down life and blessing upon himself and upon the world. If he chooses evil, he causes suffering and death. This is the judgment according to which God bestows His shefa (a kabbalistic term referring to the bounty or abundance that flows from God to the world) on the world. For when He created the world, He determined that one who draws near to Him will benefit from a shefa of blessing, while one who distances himself will receive less shefa and life, leading to his suffering and death. A person who studies Torah and performs mitzvot clings to God, but one who distances himself from Torah and transgresses its commandments clings to death.
Thus we read:
See, I set before you this day life and prosperity, death and adversity. For I command you this day to love the Lord your God, to walk in His ways, and to keep His commandments, His laws, and His rules, that you may thrive and increase, and that the Lord your God may bless you in the land that you are about to enter and possess. But if your heart turns away and you give no heed, and are lured into the worship and service of other gods, I declare to you this day that you shall certainly perish; you shall not long endure on the soil that you are crossing the Jordan to enter and possess. (Devarim 30:15-18)
God wants us to choose life, as we read:
I call heaven and earth to witness against you this day: I have put before you life and death, blessing and curse. Choose life – if you and your offspring would live – by loving the Lord your God, heeding His commands, and holding fast to Him. For thereby you shall have life and shall long endure upon the soil that the Lord your God swore to your ancestors, Avraham, Yitzḥak, and Yaakov, to give to them. (Ibid. 19-20)
It is only right and just that one who draws near to God, the Source of life and blessing, consequently merits additional life and blessing. In contrast, one who distances himself from the Source of life is moving away from life, and is thus overcome by disease, suffering, and catastrophe.
God gave people a wonderful gift when He granted them free will, as this means the good which they receive from God is theirs justly and by right. This knowledge provides them with joy and satisfaction, as they have earned everything through their own efforts. If God just gifted everything to people, they would not experience the same joy and satisfaction (Ramḥal, Derekh Hashem 1:2).
To that end, God’s judgment must be true, precise, and specific, taking into account each and every deed, each and every word, and each and every thought. True, a person is judged in accordance with the majority of his deeds and is vindicated in judgment if his deeds are mostly meritorious. Nevertheless, he is punished for every sin he does not rectify through repentance. Similarly, even if a person is condemned because most of his deeds are evil, he still receives reward for every mitzva he does. The just King knows how to make these calculations, and He determines when reward and punishment will be meted out (Bava Kama 50a; Ḥagiga 5a).
God wishes to bestow benefit on His creations, as we read, “The Lord is good to all, and His mercy is upon all His works” (Tehilim 145:9). The purpose of punishment is to correct, not to avenge. Punishment in this world is meant to direct a person so that he leaves sin and returns to the proper path, as we read, “The Lord your God disciplines you just as a man disciplines his son” (Devarim 8:5). If one has not repented in this world and is still stained by evil, even if he has merits, he cannot be the recipient of divine goodness. Therefore, he is condemned to suffer in Gehinom, where he is purged of evil. Only then can he ascend to Gan Eden, as we read: “The Lord deals death and gives life, casts down into Sheol and raises up” (1 Shmuel 2:6). Those who are entirely wicked are eradicated in Gehinom (Rosh Ha-shana 17a; Pesikta Rabbati §40; Nefesh Ha-ḥayim 1:12).