Having trouble sorting out who is trying to do what in Afghanistan? Wars can best be understood by examining the objectives of the various participants. In short, what does each side consider a victory. This is complicated by the fact that, as the fighting goes on, these definitions of victory tend to change.
In Afghanistan, the foreign nations contributing troops, and the Afghan government, have similar, but not identical, victory conditions. For the foreign, mainly NATO, forces, the main objective is to prevent Islamic terrorist groups from establishing bases in Afghanistan, and adjacent nations (especially Pakistan). NATO also wants to stamp out the heroin production, as Afghanistan is where most of this poison currently comes from.
For the Afghan government, keeping the Islamic terrorists out is also important, but the Taliban are not, to the government, synonymous with terrorism. Afghan officials keep talking to Taliban leaders (there are many), and have succeeded in convincing some to chuck the terrorism, while keeping the Islamic conservatism. This attitude is popular because the Taliban are largely the invention of some Pushtun tribes that have adopted a particularly conservative version of Islam. The dozens of Pushtun tribes in Afghanistan and Pakistan all have different customs (both religious and secular). Pushtun government officials (including the president) see the Taliban as tolerable, if they put aside the al Qaeda stuff (world conquest and imposing their strict lifestyle rules on everyone). The government is also more tolerant of the heroin trade, mainly because many of these officials are on the drug gang payroll. But the Afghan government (going back to when the monarchy was established in the 18th century) has always been tolerant of what each of the tribes did to pay the bills. Finally, there is the ethnic makeup of Afghanistan to consider. While Pushtuns (ethnically related to Iranians) make up only 40 percent of the population, there are twice as many Pushtuns next door in Pakistan. So the head of the Afghan government has, traditionally (but not always) been a Pushtun. The job of the national leader has mainly been to mediate disputes between the tribes, and keep the foreigners out. "Running the country" was never considered part of the king's job description. NATO and the U.S. have a hard time understanding the lack of enthusiasm among Afghans for establishing a Western type national government.
The more extreme Taliban want to turn Afghanistan back into an Islamic police state, as it was in the 1990s. The Taliban leaders seem to forget that they were driven out of power in less than two months in 2001, because they were so unpopular. Not just among the 60 percent of Afghan who were not Pushtun, but among many, if not most, Pushtuns as well. In theory, al Qaeda is an ally of the Taliban. Al Qaeda wants to establish a global Islamic police state. The Afghan government understands these differences better than their foreign allies.
The wild card in all this are the drug gangs. Most of these are tribe based, so the leaders of the tribe are on the payroll. But so is the Taliban. Over half the world's heroin comes from one province; Helmand, which is also the home of key Taliban tribes. The government knows that, as long as the drug lords are using the Taliban to guard their operations, the majority of Afghans will oppose them. Mainly because the large amounts of money the drug gangs have, enables them to hire and arm large numbers of tribesmen, and bribe many government officials (especially army and police commanders.) That combination of cash and fanaticism is why the Afghan government tolerates all those foreign troops. By tradition and inclination, Afghans don't care for foreign troops, which is one reason why the Afghan president makes such a big deal out of NATO air power killing civilians.
NATO and the U.S. have a problem with time. Normally, Americans start to get antsy once a war passes the three year mark. Afghanistan has been going on for eight years now, but the casualties have been very low (until 2004, less than one death a week, and that has gradually increased to three deaths a week in 2008). This year, there will be about four deaths a week. But with the victory in Iraq, all attention now shifts to Afghanistan, and now the three year rule is starting to take effect. More and more people (in Europe as well) want Afghanistan over. This cheers the Taliban no end, as they see the foreigners losing patience and leaving, at which point the drug gang/Taliban coalition taking over. That won't happen. The U.S. can supply the government with more weapons and air support, and the 80 percent of the population that opposes the Taliban will finish the war. But this will be a bloodier and non-politically-correct war. The West will be blamed, but that will be seen as preferable to having Western troops doing most of the fighting.
The U.S. and NATO nations may just declare victory and leave. This can happen. If the Taliban somehow took over the country again, NATO and/or the U.S. would return if Afghanistan once again became a terrorist base.
As you can see, Victory In Afghanistan, is a moving and constantly evolving concept, and always will be.