Doesn't it seem like most terrorists are Religious people?? Please explain why you think this is. I'd say getting bullied, poverty, and humiliation all increases the likelihood of terrorists and military Dictatorships, but what is it about Religion that creates terrorists?
Weirdly, this is a subject of interest to me. I've studied it too much to be healthy, probably. Pro Tip : Getting on a plane with a book called 'Why Terrorism Works' leads to your fellow passengers getting nervous.
Anywhoos...
It's not only religion that leads to terrorism, not by a long shot. Ultimately, you need to have an ideology which can justify extremist behaviour. Whilst this can certainly be religion, it can also be political (eg. Red Army Faction) or nationalistic (eg. ETA).
This framework/cause needs to cut through enough that people can justify extreme behaviour and violence. They are serving a 'higher cause' in many cases.
Of course, once that is established, there are entirely pragmatic considerations. Some acting under the name of a terror group are simply violent anti-socials who have found a support network and 'acceptable' way of expressing their violent tendencies. Others are purely mercenary, working for terrorist groups or causes for financial gain, or similar.
The other thing that is required is a level of powerlessness. The deliberate targeting of civilians is not limited to terrorist groups (eg. Nagasaki), but the reason for using terror and guerrilla tactics is largely tied to a need to be able to garner publicity for the cause and force action which exceeds the actual damage done.