Shah was stupidly believing in BS superstitious stuff. That's why he oppressed every one but mullahs. Under his rule, number of mosques got a 25-times increase! and Iran was a religious country.
Hopefully, mentality of Azerbaijanis are no close to the countries that you expected. That's why we have many scientists(Nobel prize winner, Famous Inventors, ..), ... for a 9 million persons country. In such a educated country, you cannot have islamism even in your wildest dreams
Actually Shah was not that superstitious, he had respect for religious men like in every other Muslim country.
My understanding of it after years of analysis is that he gave up hope on the US and its western allies when they refused him nuclear energy, and maybe a nuclear bomb, while exposing Iran against nuclear Russia as the gendarme of the middle east, selling it the US best weapons including the Tomcat F-14 to counter the repeated intrusions of Soviet reconnaissance Mig-25s Foxbat over Iranian space, but nothing beyond that, while it faced nothing else than nuclear war for the sake of being a strategic partner to the US in the OIL richest Area of the world.
His move to leave power was very objective in two folds, he wanted to save his people, the Iranians from a blood bath against the military, for which he would have been considered responsible and for good reason, since the armed forces obeyed him blindly, and secondly to save the Iranians from a most probable confrontation with the USSR where they were exposed to a nuclear war, since any land invasion would have been futile for Russia; I still remember a very high ranking intelligence officer saying that 40 million armed Iranians would face any soviet land invasion. So the nuclear war was quite plausible at that point.
I truly believe that a Soviet Invasion of Iran was in the making at that time, and Iranian intelligence and the Shah obviously got word of it, That is why they wanted nuclear energy and ultimately nuclear weapons as a credible deterrent. they also had no trust in the US to come to their defense in case of imminent war; the help stopped at providing - selling - top gun weapons to Iran.
Iranian assessments were proven right with the Invasion of Afghanistan and the aim to invade Pakistan too by the Soviet Union later on.
In other words the Shah's move saved Iran from a deadly confrontation with a nuclear superpower neighbor.
Ayatollah Khomeini or Mullah as some like to call him, was the alternative and the mean to keep the Soviet bear at bay, by cutting all relationships with the US and hence nullifying the Soviet threat perception concerning Iran.
This is called dynamic strategy, sometimes it goes smoothly and sometimes it has to be forceful.
There are other factors that went along the Iranian strategy, like the complete rejection of the western, mostly American way of life and way of everything else (which is called Islamisation, anti- west, terrorism...), which shows the deep hurt Iranians including their Shah felt by the rejection of the US and other western countries of their nuclear or better said deterrent demand to secure their position of the most powerful
pro- western nation of the middle east against any odds (mainly the Nuclear USSR).
This might tell you something about befriending the US and Usrael too closely.