36:31

וְאֵלֶּה הַמְּלָכִים אֲשֶׁר מָלְכוּ בְּאֶרֶץ אֱדוֹם לִפְנֵי מְלָךְ־מֶלֶךְ לִבְנֵי יִשְׂרָאֵל׃

And these are the kings who reigned in the land of Edom before any king reigned over the children of Israel.

Bereshit 36:31

וְאֵלֶּה הַמְּלָכִים אֲשֶׁר

Bereshit / Genesis 36:31 · Pshat

Bereshit 36:31

וְאֵלֶּה הַמְּלָכִים אֲשֶׁר מָלְכוּ בְּאֶרֶץ אֱדוֹם לִפְנֵי מְלָךְ־מֶלֶךְ לִבְנֵי יִשְׂרָאֵל׃

And these are the kings who reigned in the land of Edom before any king reigned over the children of Israel.

Pshat פְּשָׁט

The kings of Edom

Why does the Torah need a long list of a foreign people's kings? Rashi sees a count in it: eight against eight. And Ramban, the fulfilment of the blessing Yitzchak gave Esav.

Rashi writes: there were eight kings of Edom, and against them Yaakov (Jacob) set up eight of his own, from Shaul (Saul) to Yehoshafat, and in their days he cancelled Esav's (Esau's) kingdom. Only under Yoram son of Yehoshafat did Edom revolt and set up a king. Ramban explains: this is the fulfilment of Yitzchak's blessing to Esav, "by your sword you shall live". Esav's descendants overcame the Horites and reigned in their land. But the Torah says none of the kings was a king's son, as in Israel. And "before any king reigned over the children of Israel" means: when Israel has a king, Edom will have no kingdom, and "you shall serve your brother" will be fulfilled.

How Rashi and Ramban explain it

Rashi And these are the kings and so on

There were eight, and against them Yaakov set up his own and cancelled Esav's kingdom in their days. These are they: Shaul, Ish-boshet, David, Shlomo, Rechavam, Aviyah, Asa, Yehoshafat. And of the days of Yoram his son it is written: "in his days Edom revolted from under the hand of Yehudah and set a king over themselves" (Melachim II / II Kings 8:20). And of the days of Shaul it is written: "and there was no king in Edom, a deputy was king" (Melachim I / I Kings 22:48).

Ramban And these are the kings who reigned in the land of Edom

This was written to say that Yitzchak's blessing was fulfilled in him, which said to him: "and by your sword you shall live" (Bereshit / Genesis 27:40). For they overcame the sons of Seir the Horite and reigned over them in their land. And these towns are districts in the land of Edom. For Botzrah belongs to Edom, as it is written: "for the Eternal has a sacrifice in Botzrah, and a great slaughter in the land of Edom" (Yeshayahu / Isaiah 34:6). And the land of the Temanite is of Edom, as it says of it: "and your mighty men shall be dismayed, O Teman, so that every man may be cut off from the mount of Esav" (Ovadyah / Obadiah 1:9). And so all of them.
But Scripture related that they had no king who was a king's son, as there were in Israel. And "before any king reigned" means many days before. And the meaning of "before any king reigned" is not that the kingdom of these lasted until the kingdom of Israel, but that then they will have no kingdom, so that "and you shall serve your brother" (Bereshit / Genesis 27:40) be fulfilled. And it may be that all of them had passed already in the days of Moshe, for they were old when they were made kings and did not live long.

Takeaway

The eight kings of Edom: Bela, Yovav, Chusham, Hadad, Samlah, Shaul, Baal Chanan, Hadar (Bereshit / Genesis 36:32–39).
Rashi's eight kings of Israel and Yehudah: Shaul, Ish-boshet, David, Shlomo, Rechavam, Aviyah, Asa, Yehoshafat. Under Yoram Edom revolted (Melachim II / II Kings 8:20).
The blessing to Esav: "by your sword you shall live, and you shall serve your brother. And when you grieve, you shall break his yoke from your neck" (Bereshit / Genesis 27:40).