the world
 how to end

Terrorism is simply a cross between war and crime. So are bullying and other forms of aggression. So the same solutions apply.

But what about fighters motivated by anger or ideology or religion?

If their strategy works then it is rational, by definition: because it deals with cause and effect.

So we can accept that it works, and discuss it rationally on that basis. Then offer them a better result than they get by harming us.

If their strategy does not work then in the long term they will always be weak. So we can use our superior strength to identify and isolate them. Let the smart ones join us, and the remainder, isolated, cannot harm us.