Most militaries are trained in conventional warfare, usually nation verses nation or army verses army. Fighting terrorism is something new, and the USA, UK, Russia, etc have made a lot of mistakes. That includes killing innocents in order to get terrorist leaders, etc. Let us hope we can learn from those mistakes in order to prevent killing innocents.
If you are rich you fight with stealth bombers, if you are poor you fight with suicide bombers. It is also hard to tell an innocent from a terrorist until a person blows up in your face anyway.
One way to fight terrorism might be to make economic conditions better in a country so that its people are less likely to be recruited by terrorist networks. Yet that is a really hard thing to do without being accused of trying to control the nation.