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

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

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

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

Remez רֶמֶז

Eight times "my lord"

Ba'al HaTurim writes: Yaakov (Jacob) called Esav (Esau) "my lord" eight times, and so eight kings reigned in Edom before Israel. And against them eight kings of Israel, up to Yoram, under whom Edom revolted. Rabbeinu Bahya lists the eight kings of Edom and all eight "my lord"s in the story of the meeting. He adds that against them God handed down a name of eight words, to accuse them, and that no king of Edom was a king's son. The list of kings proves that the blessing "by your sword you shall live" came true.

How Kitzur Ba'al HaTurim and Rabbeinu Bahya explain it

Drash דְּרָשׁ

Eight against eight

The midrash Bereshit Rabbah brings Rabbi Aibu: before a king arose in Israel, a king already stood in Edom. Rabbi Yose bar Chanina says: when that one sets up kings, this one sets up judges, and when that one sets up chiefs, this one sets up princes. Rabbi Yehoshua ben Levi: that one set up eight, and this one set up eight. Then Nevuchadnetzar came, mixed them together and cancelled both. Lekach Tov notes: Edom's kings came from different places, but of Israel it says: "from him the cornerstone, from him the tent peg", from him its priests, prophets, kings and princes.

How Bereshit Rabbah and Midrash Lekach Tov explain it

Sod סוֹד

The kings who died

Agra DeKala writes: the secret of this portion is in every person. From birth all his traits are "broken": love loves what is forbidden, fear fears the wrong things, pride exalts itself. Then they are called "the kings of Edom". When a person repairs them by Torah and commandments, love loves the Creator, and then they are "the kings of Israel". The kings of Edom reign first, for the evil inclination rules before the good. Ba'al HaSulam brings the teaching of the Arizal: all four worlds, Atzilut, Beriah, Yetzirah and Asiyah, are made from what was sifted out of the seven kings this verse hints at. These kings reigned and died, then were sifted again and then endured.

How Agra DeKala and Baal HaSulam explain it