NATO, Afghan and U.S. commanders in Afghanistan agree on one thing, the key to victory is tribal politics. It is the tribes that control most of the territory in Afghanistan, and the areas of Pakistan that border Afghanistan. The major problem with tribal politics is that sometimes the tribes decide that illegal activities (like drug production and smuggling) are acceptable. Disputes over stuff like this can unite tribes against the government. The Taliban movement (which seeks to make the religious and social customs of a few southern tribes mandatory for all the Afghan tribes), on the other hand, is very divisive, but still hostile to the central government.
"All politics is local." In Afghanistan, local politics is heavy on inter-tribal issues. For the last few years, some tribes have been resisting Taliban influence not because they necessarily oppose the group's ultra-conservative version of Islam, but because the local Taliban leadership comes from rival tribes. The government has been exploiting this. Indeed, this is one area where the Karzai government has had lots of success, by negotiating deals with pro-Taliban tribal chiefs. The problem is that these arrangements, while they often end up with tribes less hostile to the government, also leave the tribes as independent as ever from government control. This was a problem the Taliban had when they were running the country. The Taliban fell in late 2001 largely because the United States and its Afghan allies made it clear that smart bombs now prevented the Taliban from retaliating against defiant tribes. The Taliban has always ruled by fear, and has not changed its methods. The tribes remember the Taliban's brutal reprisals, which were at a peak in the Summer of 2001.
A lot of the fighting in Afghanistan isn't about religion or "expelling the foreigners." No, it's usually about money, power and tribal politics. The current Afghan government is having the same problems "running the country" that the Taliban did. These were the same problems the loose coalition, that defeated the communist government in the early 1990s, had. These were the same problems that the monarchy had for over a century, even though the kings were usually well aware of what they were dealing with (a loose coalition of tribes and ethnic groups that don't really get along, but really can't afford to be at war for a long time.)
Afghanistan has always been a poor country. Banditry can be sustained indefinitely, especially now that the foreign troops and NGOs are here, with all manner of things to steal. Afghans don't consider it theft if you take something you need (or, let's face it, just want) from someone outside your tribe. That's just taking care of your own. And therein lies the problem. There is no Afghanistan, just a patchwork of tribes and tribal alliances. Within the larger tribes there are often nasty rivalries between large clans. Then there are the newly rich drug gangs, which are tribe based, and have changed the power relationships among some of the tribes.
The "Taliban" (religiously conservative, and violent, factions) are on a mission from God to impose strict lifestyle rules, and turn the country into a religious dictatorship. The Taliban were unable to do that by the end of 2001, and are less likely to do it in the future. But fueled by a share of the drug profits and the proceeds of other criminal enterprises (especially extortion and kidnapping) they can still entice poor, but adventurous, country boys to come along and raise some hell. And usually get killed by smart bombs the star struck kids cannot comprehend.
Meanwhile, more and more of the tribes are getting a clue and making peace with the central government. While the national rulers tend to be thieves, they are also willing to share the loot. That's another ancient Afghan custom, and U.S. and NATO commanders are willing to play along in order to prevent the country from slipping back into anarchy (real anarchy, not the Taliban terrorism that passes for it these days) and once more becomes a terrorist haven.
The U.S. Army Special Forces have been dealing with Afghan tribal politics for over twenty years. During the 1980s war with Russia in Afghanistan, it was Special Forces operators, who often spoke the local languages, who ran up against the tribal politics, and learned how to deal with it. It was this Special Forces expertise that made possible the rapid defeat of the Taliban in late 2001. Since then, it's been the Special Forces operators that often got called in when there was an opportunity to exploit situations where tribal politics was a major issue.
This "tribal politics" approach proved vital in winning over the Sunni Arab tribes (the base of Saddam's support) to work against the terrorists (who are mostly Sunni Arabs, both Iraqi and foreign.) But the Iraqi tribes have always had to deal with a stronger central government. In Afghanistan, the tribes see the central government as another "tribe", and will only deal if the government brings enough goodies to the table to make negotiating worthwhile. The Western peacekeepers have the goodies (cash, expertise and security), and bringing in another 30,000 U.S. troops in the next 18 months is expected to make the tribal politics approach weaken the Taliban to the point where these terrorists are a nuisance, not a major threat.