In order to understand the situation in Afghanistan and how it may unfold, one has to know the players and understand their goals. In this conflict, The United States, Pakistan and India are the major players, China a minor player and Iran an observer. Let's examine them in turn.
The United States
The Americans' public stance is that they are here to "defeat" the Taliban. What has been omitted is their goal of wresting Baluchistan, the southwestern province of Pakistan, making up nearly 50% of its territory. Why? Because controlling Baluchistan will seal China off from the Arabian Sea forever. Less importantly, Baluchistan is their only hope for a seaport for a highway to Central Asia, allowing natural gas to be shipped south, and troops to be shipped north.
In a dangerous gamble, the Pakistanis gave away the port of Gwadar, which is at the tip of the Arabian Sea and near the strategic Strait of Hormuz, to the Chinese. The also invited the Chinese to replace India in the erstwhile IPI (Iran-Pakistan-India) natural gas pipeline. Does anyone remember what happened to Iraq when they started bidding off their oil wells to the Russians and the Chinese?
Best Case Scenario
Control of Afghanistan and Baluchistan.
Worst Case Scenario
For the US, control of Afghanistan and Baluchistan go hand in hand. One enables the other. If they end up trotting back from Afghanistan, perhaps under pressure from protests by the American public, it will leave central and south Asia wide open for the Chinese, while the Taliban will become stronger than ever, being able to boast of having defeated yet another superpower.
Pakistan
Pakistan needs to control Afghanistan, because if it does not, two things will happen. One, the motley crew of Jihadis, pushed out of Afghanistan, will spill over in Pakistan. Second, India will build a necklace of listening posts in Afghanistan against Pakistan's hitherto secure western border.
For a long time, Pakistan has been punching above its weight by playing China against India and the Americans against Russians. This time, in their quest to spite India, they inadvertently ended up pitting America and China over their own territory of Baluchistan. On top of this, they are being forced to fight the war for the pro-India government in Afghanistan.
Best Case Scenario
Americans leave Afghanistan early.
Worst Case Scenario
If Americans remain in Afghanistan for an extended period of time, India will get an opportunity to wrest the Kashmir initiative away from them, while consolidating their gains in Afghanistan for long term pressure.
At the same time, the only way for American to have any hopes of gaining long term control of Baluchistan is if it becomes independent. If that happens, Pakistan or rather Punjab, will find itself surrounded by three unfriendly countries (Baluchistan, Afghanistan and India).
India
India does not care so much about gas as it does about Kashmir. The secessionists in Kashmir derive their power from Islamabad. If Pakistan military and political energy is continually spent fighting insurgency, this weakens the separatists in Kashmir, giving India a historic opening to negotiate a settlement. If militancy can be kept sufficiently under pressure in Afghanistan, the pressure will most certainly be released in the form of sporadic insurgency within Pakistan, achieving the desired result.
Best Case Scenario
Pakistan gets bogged down in counterinsurgency and Baluchistan becomes independent.
Worst Case Scenario
America leaves, Pakistan backed groups regains control of Afghanistan and Pakistani military establishment turns its full focus to destabilizing India. China makes heavy inroads into PoK and develops a military base in Gwadar, gaining control of the Arabian Sea.
China
The Chinese do not have much leverage over the Afghan situation at the moment, so their goals, whatever they might be, do not affect the likely outcomes much.
It is Pakistan and America who will gain or lose the most from what happens in Afghanistan. Also, as illustrated above, if America gains, Pakistan loses, and vice versa. Needless to say, America, the preeminent superpower, is going to do whatever it takes to come out the winner.
How It Will Unfold
Washington has begun making noises pressurize Pakistan to take against "Taliban" based in southern Punjab and in Quetta, the capital of Baluchistan. India has stated it is beginning closed door negotiations with separatists in Kashmir. As if on cue, Baluchistan separatists have started becoming active, while terrorist attacks are increasing in frequency in Punjab.
The goal seems to be get the Pakistani to declare war on its own people. If in the meantime, India successfully negotiates a Kashmir settlement, the militants coming back to PoK will add to the gunpowder, bogging the Pakistani military down in counterinsurgency in three separate regions. At this time, the Baluch may decide to declare independence, which NATO, Afghanistan and India will be more than happy to recognize immediately.