Who were the Medanim?
Rashbam: Medan, Midyan and Yishma'el were (paternal) brothers (Bereishis 25:2). 2 According to the simple meaning, Medan and Yishmael were one and the same, which is why it says below (Bereishis 39:1) that the Yishma'elim brought him to Egypt and sold him there.
Bechor Shor (28): Medan, Midyan and Yishma'el are all the same 3 , just like Yehudim, Ivrim, Yisraelim and Yeshurun all refer to the same nation. The name is based on what they were carrying.
This explains why Pinchas went to fight against Midyan - to avenge the sale of his maternal ancestor, Yosef, whom they sold to Egypt. (Medan and Midyanim were different sons of Keturah (Bereishis 25:2)! Perhaps he holds that Medanim are not a different nation because the Torah did not list any sons of Medan - PF.)
Riva: They are called Yishma'elim since they lived in Yishmael's land.
Why does the Pasuk refer to Potifar as "Seris Pharaoh"?
Targum Onkelos and Targum Yonasan #1: Refer to 39:1:2:1.
Ramban and Targum Yonasan #2: Refer to 39:1:2:2.
What exactly was Potifar's position?
Rashi: Chief slaughterer of Pharaoh's animals. 1
Rashbam (later): Chief judge - to pass the death-sentence over those who were incarcerated in the royal prison.
Ha'Emek Davar: The custom was, if one came to sell a slave, and it is hard to wait until he finds a buyer, the country bought him and stood him up in the market until he was sold. Potifar was appointed over this.
Hadar Zekenim rejects this, for it is To'evah to Egypt (their deity). Riva and Tosfos ha'Shalem (39:1:9) citing Moshav Zekenim say that they despised only "Ro'ei Tzon" (46:34); they worshipped only Tzon, but ate cattle. Some say that they worshipped Tzon only in Nisan, for its Mazel is a lamb. Moshav Zekenim brings Moshe's words during Makas Arov "if we would be Zove'ach To'avas Mitzrayim in front of them, would they not stone us (Shemos 8:22)?!" This was not in Nisan, for there was a month between plagues! Perhaps he meant 'we cannot sacrifice it even now, for they worship it in Nisan [even though in other months, also they slaughter and eat it].' This requires investigation (PF).
Why does it say that they sold him to Egypt?
Refer to 37:36:3:4,