Alienation need not refer to loneliness. A person can be alienated from a specific group while still having a support structure, such as a family, or a friends group, to rely on for social fulfillment. Alienation leaves a gap in a person's feeling of inclusion, one that can be filled by a shift to a different social support structure.
In the case of (some) religious extremism, the alienation can be explained by an individual losing their feeling of worth with respect to a perceived standard. For Islamic extremism in particular, many extremists came from impoverished backgrounds (Afghani poverty rates were in the ~35% area in 2007). They didn't turn to violence as a solution, instead, they turned to religious leaders who gave them a sense of purpose and worth. A VERY small proportion of those religious leaders turned their new followers to violence and terrorism.
Political extremism in the USA follows a very similar pattern. As political parties move their goalposts and standards to reflect a changing political landscape, some people eventually feel left behind. They are 'alienated' by society for beliefs that were previously OK to hold, and may feel persecuted, even if nobody knows they hold those beliefs. These alienated people will migrate to groups that validate their beliefs, or give them an easy transition into something more socially acceptable. Again, in VERY few cases, this results in violent extremism.
This is not to say that political extremism doesn't exist in the middle east, or that religious extremism doesn't exist in the western countries. I just picked the examples that are most visible for each group. Additionally, much of alienation comes from how a persons worldview is structured. If you treat worldview as a building, then politics, profession, and religion are all key pillars. Any time one of these pillars is threatened or changed, it can cause a feeling of alienation.