Saudi Arabia has been a historical ally of the United States since the late 1940s to early 1950s, and that alliance was not always what it is now. Initially, during the Cold War Saudi Arabia was viewed by the CIA and American decision makers as a an ideological ally where "men of the book" were united in interests against the "godless" Soviets. However, Saudi Wahhabism was widely regarded with an appropriate amount of skepticism who were reluctant to provide the kind of military aid to the Saudis for that reason.
The history of Saudi relations has to be read in the context of American interests in the Middle East, more generally, however. During the Carter administration, it became glaringly obvious that the pro-Western Shah's tenure was not beyond question. Initial reports from reliable sources made it clear that revolution was fomenting inside Iran, though Carter neglected to take the necessary action to prevent this from metastasizing into something entirely worse and more violent.
In his abject naivety (read: stupidity) Carter essentially disregarded the recommendations spoon fed to him by, among others, the CIA. The Iranian revolution and subsequent hostage crisis ensued. This single event forever changed the Middle East, and Saudi Arabia's relationship to the United States. Before this great catastrophe, Iran was a reliable and stable ally to the West and to the United States, in particular. The Shah's government was relatively democratic, and progressive.
In this way, Iran represented one of the two pillars of American (and to a lesser degree, British) foreign policy triangulation between Iran, Israel, and the United States. Iran's location was geostrategically vital to maintaining stable oil markets as well, and this played a huge role in the degree to which Western forces not only exercised influence in the region, but kept the Soviets out. Iran is adjacent to Pakistan and Iraq, both then allies of the United Kingdom. Nevertheless, Iran was regarded as a considerably more stable ally than Iraq, because of the differences in their culture and political climates. Kuwait, after all, was cut out of Iran by the British to function as a chokepoint in Iraq's access to the Persian Gulf. The French, at the same time, were closely allied with Syria as well.
(Note: most of these alliances were the result of the Sykes-Picot treaty, in which France and England carved up the Ottoman Empire's corpse according to their economic interests.)
A simple look at a map reveals why this was such a problem for the Soviet Union, who were already cut off from the Mediterranean sea by NATO Member Turkey, and whose sole barrier between US allies to the South was what is now Georgia and Azerbaijan. Iran bing allied with the United States created a veritable threat to the Soviets' interests on the Caspian sea. This, the KGB could not tolerate, and they had a solution. The Soviet Solution, consistent with its KGB members' Sambo training, was to take advantage of forces in motion as they existed. Sambo is the species of mixed martial arts taught in what is now Russia, but what was then the Soviet Union. It's sort of like a mixture of Judo and Jujitsu. Like many of the more sophisticated maneuvers in sambo, the Soviets' geopolitical strategy was to cultivate and channel the forces of Islamic radicalism within Iran which would lead to an Iranian revolution. That is exactly what happened, and Carter in his inexcusable incompetence failed to prevent it. In this way, the Iranian revolution shifted one of the dominoes from the US, to the USSR.
Saudi Arabia, the only remaining wild card on the map, became the next best alternative. By 1980, the Reagan administration did everything in their power to make nice with the Saudis who were themselves delighted to cooperate with the US to menace Iran -- their new joint enemy. The soviets continued to fund the development of radical islamist cells within Iran, and played a key albeit plausibly deniable and indirect role in many of the Palestinian, Libyan, and other Islamic terrorist attacks that would strike Israel, the territory of Palestine, the Middle East in general, and Europe in the coming decade. (Note: It was after having been bitten by the cobra of Islamic radicalism that the United States began to play the so called Northern Alliance against the Soviets in their woefully incompetent efforts to invade Afghanistan. This later came to be known as "Charlie Wilson's War".)
More to come in a bit...