Because, in certain parts of Afghanistan and in the North-western region of Pakistan, the Talibani ideology is a part of life. They have support of the locals. Pakistani army is seen as an outsider, which it is not. Also, because the Afghan Pak border is porous and that allows militants to change positions.
Finally, like some people already said, they use gorilla tactics. Conventional armies think in terms of winning "posts" and gaining a higher vantage point. So, when someone says that they have captured city X in region Y, it is irrelevant to Gorilla war. You could be sitting pretty in city X while Gorillas have surround your city from all sides. Gorillas think of covering an area quickly, no matter how good of a position their enemy is at, and attacking suddenly, preferably from all sides.
Finally, like some people already said, they use gorilla tactics. Conventional armies think in terms of winning "posts" and gaining a higher vantage point. So, when someone says that they have captured city X in region Y, it is irrelevant to Gorilla war. You could be sitting pretty in city X while Gorillas have surround your city from all sides. Gorillas think of covering an area quickly, no matter how good of a position their enemy is at, and attacking suddenly, preferably from all sides.