The Ramchal continues:
Before the world can reach the state where the righteous receive their eternal reward, however, all life must cease and return to the dust, for at least a moment, before the revival of the dead. Then those that are fitting will rise.
When the revival of the dead occurs, both the righteous and the evil will be brought back to life. There are evil people who will not yet have received their due punishment, and they will be brought back to life and punished as befits them.
After the revival, there will be the great day of judgment, and Hashem will judge everyone, deciding who will live eternally and who will be lost to oblivion. Those who are part of the latter group will receive their due punishment and in the end will be erased completely from existence. Those who are destined to remain will be placed on the level that they deserve according to the Divine judgment.
Coming back to the days of Moshiach, there will be a great selection process for the nations of the world who exist at that time. Those that the Divine judgment will determine are fitting for destruction will die by the sword and through other punishments. Those that are fitting to remain will be saved. They will recognize the Truth and abandon their false gods. They will make themselves subservient to the children of Israel, and it will be their honor to serve the Jewish people, as they will realize that through this service they will be able to receive what they can from the Holiness and Light of Hashem.
The whole world will be drawn after service of the Creator, and there will be no idolatrous practices at all in the world. This is what the navi referred to when he said (Tzephaniah 3:9), “Then I will turn over the nations to one clear language,” as well as the verse (Zechariah 14:9), “On that day Hashem will be One and His name will be one.”
After all those that deserve it are prepared for eternity, each one on his level, the world will return to a state of chaos and desolation (תהו ובהו). This means that it will lose its current form, and water will return to water as it was at the beginning of Creation. In any event, the righteous ones who are prepared for eternity will be sustained by Hashem during that time like angels, without a need for this world. Nevertheless, they will still not attain the true Good that befits them until after the world has remained in this desolate state for the time that Hashem’s wisdom decrees. Then the world will be renewed in a different form, appropriate for what is necessary for eternity, and the righteous will return and exist forever, enjoying the true Good, each one according to his level.
Here ends what Ramchal says in his mamar ha’ikarim. It’s important to mention that elsewhere the Ramchal clearly states that this righteous group of tzadikim that exist forever contains most of the Jewish people. Only very few individuals are considered so evil that they are completely erased (the Gemara in Rosh Hashana gives the list on daf 17A). This is the idea כל ישראל יש להם חלק לעולם הבא – all of the people of Israel have a portion in the next world. Some people will have to undergo greater levels of cleansing of their soul to purge the evil they have done, and some less. Ultimately, once they are purified they are included in this group of righteous individuals who exist forever, basking in Hashem’s Light.