Why did the US shelter the Shah of Iran?

Answer #1:

There are three main reasons.

Historical Relationship: The Shah had been an ally of the United States during his entire reign. As a result, there was a historical relationship between him and the United States.

American Coup d'√Čtat: The United States was the country that restored the Shah to the throne and as a result, there is a strong connection for the Shah to the United States.

License to Kill Dictators:
If the Shah was returned to Iran, he would face a kangaroo court and be summarily executed. This would send a flag to any dictator anywhere in the world who was Pro-American that America will only protect you until you are deposed, leading to defections to the Soviets who would continue to protect them. To show that America looks after its foreign policy interests, he was not handed over.

Of course, to Iranians who wanted to exact justice on their tyrant, these were not acceptable reasons.

Answer #2: The US did not necessarily shelter Shah Pahlavi. After his exile from Iran when Ayatollah Khomeini was voted into power he traveled from country to country seeking shelter, when he was in Mexico as a guest of Jose Lopez Portillo, the Mexican president of the time, he required immediate surgery which he elected to have done in the US. Thinking it wouldn't be a long stay and the Shah would leave the country after the surgery, then-president Jimmy Carter allowed him to have the surgery done in the US. Although we supported the Shah (And ultimately was the reason he was put in power after the CIA deposed Mosaddegh), the US harboring of an exile upset the new Islamic administration of Iran and the US did not want to anger them as they were still upset that the CIA deposed Mosaddegh 38 years prior. It is thought that the kidnapping of American citizens that happened in Tehran while the Shah was in the US was a direct result of allowing the Shah into the US. After his recovery, he then continued his travels while Iran futilely attempted to have him extradited from Panama until finally being granted permanent asylum in Egypt under then-president Anwar El-Sadat where he stayed for the remainder of his life, which wasn't very long as he died from complications from non-Hodgkins lymphoma (A type of cancer) shortly after.