Why was the Shah overthrown by Ayatollah Khomeini?

Answer 1
This is incorrect, please read the book All the Shah's Men for a good understanding of how the Shah or Iran was put into power and how he was thrown out. Ayatollah Khomeini was a leader of a religious and political uprising that was cultivated by the actions of the United States fledgling CIA ie Kermit Roosevelt.

Answer 2
There is a supposition in this question that is partially incorrect, namely that the primary or most important people to overthrow the Shah were fundamentalist Muslims led by the Ayatollah Khomeini. This is not the case. The Iranian people, most of them traditional or secular Muslims revolted all across Iran. The Religious Fundamentalists were a minority of those Iranians who were protesting. When the Shah abdicated, there was an intent to create a Republic that represented the Iranian People. However, between April and October of 1979 (after the Shah had already departed the country and the Islamic Republic of Iran declared) the Ayatollahs were able to consolidate power and create the Constitution of the Islamic Republic of Iran which vested the Religious Fundamentalists with political power.

Iranians in general were opposed to the Shah and opposed him from nearly every political perspective. These include:
  • Some said that the Shah was not religious enough
  • Some believed that the Shah's policies were too oppressive
  • Some believed that the Shah was modernizing without preserving Iran's cultural heritage and others were angry that he was moving too slowly
  • Some believed that the Shah was a sellout to foreign interests and others believed his foreign focuses were too narrow.
  • Some believed that the Shah did not grant women enough rights and others thought that women had too many rights.
  • Some believed that the Shah should have encouraged more middle class growth and others believe he should have put more capital into industry.
  • Some wanted more privatization and others wanted more nationalization.

As concerns the specific reasons for the Iranian protests and the eventual revolution, they were numerous:

Wealth & Employment Issues: Most importantly was the wealth inequality between the Shah and the nobility and common Iranian citizen. There was immense poverty throughout the country and high unemployment, underemployment, low wages, and few protections for laborers.

Religious Conservatism: Most Iranians were religiously conservative (similar to the American Bible-belt as opposed to the Fundamentalists) and resisted the Shah's Westernization and Secularization movements in Iran. The Shah made clear that religion was not important to him as a ruler, whereas it was a concern among the people.

Puppet to Foreigners: The Shah was also seen as a Western puppet, especially when the CIA overthrew the Iranian President Mossadegh in 1953 to re-install the Shah of Iran and considering how Iran profited very little from its own petroleum.

Brutal Secret Police: The Shah had a notorious secret police called the SAVAK which harassed people and killed scores of others.

Authoritarianism: Iranians wanted to be in control of their own affairs. Iranians wanted some form of self-government or democracy. The Shah was an authoritarian who prevented people from expressing their own opinions.

Issue for Fundamentalists: Particularly in the fundamentalist camp, the fundamentalists in Iran felt that the Shah epitomized a Western culture of greed and materialism, because he tried to establish a more secular government. As with many rulers, he accumulated vast personal wealth. He also employed various means to suppress political dissent. It was ultimately the exiled Ayatollah Khomeini who in 1979 succeeded the Shah and established an Islamic religious government.

Note: The fact that these grievances existed does not mean that the Islamic Republic of Iran afterwards "fixed" these problems.