How has Pakistan managed to defeat the US in Afghanistan?
I don't think the USA is already defeated. I think they are merely struggling. On the other hand, Russia and China are entering this region making the puzzle even more complex.
The possible end result would be a negotiation between the USA and Pakistan so that the USA can safely escape a Second Vietnam
.
Why has Pakistan so far managed to outplay the US in Afghanistan?
Coz, it is their home turf. Most importantly, it is them.
What mistakes and misunderstandings on part of the Americans has led to this embarrassment?
Wars cannot be won only with brute force
https://www.thenation.com/article/a-us-military-officer-explains-why-americas-wars-in-the-middle-east-have-been-utter-failures/
Taliban faction is part of a large population.
Remember, Taliban are Pashtun people. Pashtuns are the ancient indegenous population of Afghanistan. In fact, the term Afghanistan
literally means the land of Pashtuns
. With 42% population, Pashtuns are the majority in Afghanistan.
When the Northern Alliance
took control of the country, Taliban were declared pariahs. When Americans invaded Afghanistan, they sided with Northern Alliance and engaged in an effort to wipe out Taliban. A better strategy would have been to call them to participate in a dialogue so that they could be brought to mainstream politics.
All 'Talibans' are not Talibans
Times and again US politicians have proved that they don't either understand Pakistan's view of Taliban or deliberately ignore it.
Tehrik-i-Taliban (TTP) Pakistan is actually neither the part of the classic Taliban nor share common goals. This is a different group, based in Afghanistan who acts against Pakistan's interest. Some sources suggest that India funds this group.
Why is Pakistan maintaining links to Taliban and Haqqanis?
The Durand Line: Northern Alliance and their successors are a threat to Pakistan's sovereignty in that they do not accept Durand Line as the demarcation between Afghanistan and Pakistan. That virtually makes them a demander of more than half of Pakistan's territory. Taliban do not possess such a radical theory.
The Indian Job: India is constantly trying to build up a sizable presence on the Western border of Pakistan so that in war situations, they can have a strong foothold on the both sides of Pakistan. India is expanding its influence in Afghanistan. They have become successful so far in that they are being able to wage a proxy war by using Afghans. India has also established military bases on the western border of Pakistan namely Fakhor Airbase and Ayni Air Base. They have also established a port in Iran. India has also stepped up the funding of anti-Pakistan terrorist organizations in the recent years. These are direct existential threats to Pakistan. Without the Northern Alliance, there will be no Indian influence, and, the USA is encouraging both the Indian presence and the lead of Northern Alliance in Afghanistan.
Since these two factors are directly connected to Pakistan's existence as a state, neither cutting of aid nor diplomatic pressures will be able to deter them.
Same old Carrot & Stick policy
The USA has a long history of corning Pakistan when necessary and subsequently abandoning them when they were in need of help. From losing landmass to losing wars, This carrot & stick policy of the USA has done severe damages to Pakistan. On the other hand, USA's neo-love affair with India virtually signals the abandonment of Pakistan as a major ally.
Taking this as a hard truth, Pakistan seems to be shifting its policy against the dependence on US-made arms, and financial aids. Recent developments include, the Sino-Pak joint venture is jet-fighter development, Pak-Turk defense ties, and overall, the Pakistani pitch in developing its infrastructures to facilitate fast-track economic development. These initiatives will take time, but ultimately guarantees Pakistan's true independence from the USA.