The United States had been a consistent supporter of the Shah of Iran. His country's increasing oil wealth made an alliance with Iran very important to the US. The US sold ever-increasing amounts of military equipment to the Iranians, both to help secure Iran's position as a bulwark against communism, and to meet the American need to recycle petro-dollars (e.g. to get the oil-producing nations to spend their newly acquired wealth in the US). The Shah, however, was under increasing pressure to reform. He often ruled with an iron fist, making use of the SAVAK, his secret police.
Domestic opposition to the Shah mounted from both the right and the left. The left wanted greater reforms, and the right, led by Muslim fundamentalists who opposed most of the Shah reform, wanted to eliminate the growing Western influence in the country. Most outside analysts believed that the Shah would have no problem maintaining his rule. What they did not know was that the Shah had been diagnosed as with terminal cancer. He seemed to have no will to suppress the growing violence against his regime, and despite pleas from his army commanders, he refused to allow them to use force.
By this time, a single leader was developing in the opposition: the Ayatollah Khomeini, a leading Muslim fundamentalist living in exile in France. On July 16, 1979, the Shah left the country for a "vacation." Two weeks later, the Ayatollah had returned to lead a new fundamentalist government.
In late October, the Shah arrived in the United States to receive medical treatment. On November 4, 1979, a mob of Iranian students attacked the US embassy. They seized the embassy personnel as hostages. This was a violation of all norms of diplomatic behavior.
For a year, the hostage crisis dominated US policy. President Carter made it clear that obtaining the release of US hostages was his highest priority. Despite his efforts, no progress was made. In April 1980, a military rescue mission was attempted, but had to be aborted before it had come anywhere near the hostages.
Finally, after the election of Ronald Reagan, the Iranians released the hostages after receiving a release of their impounded assets.