ISIS (Islamic State of Iraq and Syria) looks like it took the U.S. intelligence community by surprise. You would think the CIA and other intelligence services would have seen this coming. But, looking at past failures of intelligence and analysis, I don't think the CIA is much at fault (purely on intelligence gathering and analysis. The ethics of imperialism are another matter, which I write about frequently, but not in this particular story).
The historical analogy that leaps to mind is the rapid collapse of the Chiang Kai-shek regime in China during the years following the end of World War II. In retrospect everyone, including Chiang, should have seen it coming. So why was it (the rapidity) such a surprise (even, to a large extent, to the Chinese Communist Party, which expected a much longer civil war to be required to take power)?
In both cases, the rising power was stronger than appearances led people to believe. More important, the existing power was weaker, to the point of being a sham.
ISIS does not have the long history that the Chinese Communist Party (CCP) had by 1946. Nor did it have, in say 2012, the base areas that the CCP had. But there are some similar characteristics.
ISIS is driven by radical Islam, which apparently is quite the motivator of men. The CCP was driven by a Chinese version of Marxism, later called Maoism, which also was very motivational.
External factors helped both groups. China had been invaded by Japan, but had been in chaos long before the Japanese decided to risk their lives to try to "restore order." Similarly Iraq had been invaded by the United States (USA), also allegedly to create a democratic, peaceful order there.
The government as run by Chiang Kai-shek was incompetent and corrupt, in many cases amounting to little more than the rule of warlords. Most Chinese felt oppressed by the "Nationalist" government, and had heard the CCP governed base areas were far better off. While the government of Iraq has support in some sectors, particularly among the Shia sects, among the Sunni sects there has long been a belief that the government is an enemy.
In the most obvious parallel, the United States armed and financed Chiang Kai-shek, as it still arms and finances the Iraq government.
The Chiang regime might have gone on ruling China incompetently had it not been for the emergence of the CCP, with its high levels of skill at both governance and war.
Apparently ISIS also has a great deal of competence at governance and war. ISIS leaders may be ultra-conservative Sunni Islam, until recently affiliated with Al Qaeda, but about two years ago they began to prioritize finances and governance. Ascetics themselves, they gained popular support by redistributing wealth to the common people, much like the CCP and the New Deal Democrats in the USA. They also used their taxing power to build up a well-trained army, and apparently to bribe both tribal leaders and many members of the Iraq army.
It is said, perhaps with some exaggeration, that Chiang's troops were defeated with the very U.S. weapons that were supposed to solidify his regime. The troops did not like the way they were treated, so they just went over the the Red Army, taking Chiang's shiny new U.S. manufactured weapons with them.
I doubt ISIS can take over all of Iraq, and I doubt they want to. By unifying the Sunni portions of Iraq and Syria they might create a new, viable state. If the lines had been drawn that way when the Ottoman Empire was defeated in World War I, a lot of trouble might have been saved. Instead the French, British and American empires drew lines in the sand for their own convenience, creating the modern states (not really nations) of Lebanon, Palestine, Jordan, Syria and Iraq.
Perhaps the Kurds will finally get their own nation. Given Woodrow Wilson's pious, if hypocritical, yammering about national self-determination after World War I, again a lot of trouble could have been saved by just doing it then.
But of course the imperialist powers, the U.S. more so than Britain and France, do not want rational borders in the Middle East. They want a weak Middle East, and that requires lumping together Shiites and Sunnis, so that they will fight each other and be U.S. puppets, rather than gaining true independence and equality within the world community
The current version of Iraq is not yet done. A democratic and united Iraq could still emerge, but it will be a lot harder now. The government of Iraq has more popular support than the Nationalist Chinese government ever did (Chiang never risked having an election, for instance). Also, ISIS may alienate the very people who welcome them today. It would not be the first time in history that has happened.