Why did the Shah of Iran leave Iran?

The Shah of Iran abdicated because he felt that he was no longer able to hold back the Islamic Revolution; it was too widespread. It had become apparent by Black Friday (September 8, 1978), that there would be a confrontation between the Shah and the Revolutionaries of all stripes. The Shah ultimately did not believe that he could effectively suppress the Revolutionaries.

The Shah's first place of exile was Egypt in early 1979, followed by Morocco, the Bahamas, and Mexico, each for a few months. However, he fled to the USA towards the end of the year for medical treatment. That is when Ruhollah Musavi Khomeini comes to ran and rose to power. He ordered an attack on the us embassy and the taking of American hostages in order to demand the extradition of the Shah (so that he could be tried by the Iranian people and executed). President Jimmy Carter was seriously considering handing the Shah back to Iran, but thankfully, Anwar Sadat, the president of Egypt, accepted the Shah as a permanent exile in his country.

[See Discussion Section]