Terrorism is used to provoke an unlawful, disproportionate response that violates citizens expectation of rights and protections. By doing so a government breaks the social contract with citizens, which leads to questioning the right of that government to exist. Long term fear leads to anger, anger leads to blame. People blame their government for not protecting them. This leads to revolution, which is the terrorists' goal. The overthrow of governments by the citizens.
Terrorists are political animals. They don't eat, shit, or piss unless their politics tells them to do so. The are revolutionaries who realize their own cause can't draw enough people or funds to actually cause the revolution. So they turn to terrorism and wait for the targeted governments/societies to tear themselves apart. In that chaos they hope to emerge in a position of power, however they have accepted they may all die to get there.
So every idiot out there who tells you that you should be afraid, afraid of refugees fleeing these same terrorists, strangers, your government, your fellow citizens, they are doing the work of the terrorists for them. Donald Trump saying he would bomb ISIS is falling into that trap (if it were that easy, drop a few bombs, we would be way past the time when they were all dead). Every idiot saying "we should kill all the muslims" is doing the work of the terrorists. That's exactly what ISIS/al Qaeda wants us to do. Every Congressperson and Senator who says we shouldn't close Gitmo and handle these people as either criminals or repatriate them is doing the work of the terrorists.
This is how they work. They divide us up, make us come to the conclusion that only revolution will cure us of the disease. Drive us to remove rights and oppress others, violate our own laws and societal customs. All of this is exactly what the terrorist wants. Even to the point of their own extinction, this is what they want.
Because the ultimate goal is to kill off the targeted government. If the terrorists survive to take advantage of the situation, that's just the icing on top.
Don't fall into their trap.
And, yes, so far they're winning because G. W. Bush forgot that lesson once he walked back into the White House on 9/11 and fell prey to the chickenhawks in his administration. You only have to look at the racist, isolationist, chest beating responses to the Paris attacks to see that they are winning. Look at how Europe is responding. That's because they have had decades longer experience dealing with terrorism (especially when it was home brewed). They know this playbook better than we do.