The problem with terrorism is that, in many ways, it's like crime. Just about anyone with a motive adn the will can do it just about anywhere.
In Conrad's the Secret Agent, perhaps one of the best books on terrorism, one of the characters is a bomb maker and makes the interesting observation that an act of terrorism is basically one of character. Does the person have the character to blow themselves up and do those who wish to prevent him, have the character to stop it.
It is impossible to fight that kind of thing with mere tanks and helicopter gunships. Terrorism is psychological warfare when exercised. But it is also psychological warfare in the minds of those who act in terrorism.
A couple good films on terrorism that anyone interested in learning more about terrorism should see are The Battle of Algiers- which is basically a terrorist campaign, and Four Days in September, about the kidnapping of the American Ambassador in Brazil.
In Battle of ALgiers, one sees the desperation of the French in stopping the terrrorists and the panic caused by the terrorists in a few acts of violence. In 4 Days in Sept you get an insight into the minds of the terrorists themselves- some are ideological romantics, others cold hearted fatalists, some just naive and other's cruel.
Key here is that it's people who act, like criminals, based on different motives. What holds them together is a common cause which often they don't fully understand. There is often a feeling to "do something" or "to make a statement" much the way a suicide often comes with a message or statement of motives.
This is a war of hearts and minds, and requires an approach that appeals to hearts and minds. It cannot be won with bullets and blood alone, but by delegitimating the population of support for those who commit acts of terror.
The US is not doing that in the middle east because the emphasis is on power and control. Acts like failing to pay policeman, or harrassing Muslims, or torturing terrorists suspects, or failing to stop the assassinations and bombings- this all adds fuel to the fire. By failing to acknoweledge the culture of the area, the US is opening itself to increased criticism.
If the US is there to democratize and make Iraq a better place, it has to convince the Iraqis that's the purpose. It has yet to achieve that result. And that failure in Iraq is showing up all over the middle east because the camera is on the US. The Muslims are watching America and how it behaves.
It costs billions to maintain the US presence in Iraq. It cost significantly less to crash airplanes in buildings on 9/11- but it did require a handful of people who were willing to make those sacrifices.
Which is perhaps why the US may lose this war.