There was a revolution in Iran in 1979 because the people of Iran had become disenchanted with the rule of the Shah. They felt that he was modernizing and Westernizing their country to a degree that they could not accept. They also disliked his authoritarian and repressive policies. When their unhappiness was paired with economic stress and some tentative reforms, it finally erupted into revolution.
The Shah had ruled Iran since being put in place by the West in 1953. He tried to make Iran into a modern, secular country. He also tried to keep all political power for himself, suppressing other political views and ruling, in essence, as a dictator. This was a bad combination. The Shah imposed authoritarian rule on the country but did not give it a reason to love him. Most importantly, he tried to reduce the influence of Islam in the country when religion was much more important to most Iranians than the idea of Iran as a country or the Shah as their leader.
What all this meant was that Iranians were generally unhappy and they had no real outlet for their anger since they could not participate in politics. By 1979, economic conditions had declined in Iran. This put more stress on the people. In addition, the American president, Jimmy Carter, was pushing the Shah to improve his human rights record. This induced the Shah to make a few concessions and to loosen his grip on the country to some degree. What ended up happening, then, was that unhappy people were able to take advantage of the Shah’s relaxed rule to engage in massive protests. These protests induced the Shah to leave the country, ending his rule.
Thus, we can say that the revolution in Iran happened because the Iranian people were very unhappy with the Shah’s authoritarian and pro-Western (and perhaps anti-Islamic) regime.