After the 11 September 2001 attacks, American military forces invaded Afghanistan in pursuit of Osama bin Laden’s head. This required toppling the Taliban government of Afghanistan, which had sheltered the Arab jihadi. The Taliban fell and its survivors withdrew into Pakistan, but American and Afghan forces failed to capture Bin Laden.
The American government then set about transforming Afghanistan. Partly, this meant providing military security. American forces remained in Afghanistan, although the numbers diminished after the attack on Iraq in Spring 2003. Partly this meant economic and social modernization. Roads and bridges were built to connect the countryside with the few big cities. Schools and hospitals rose up. Women saw many opportunities open before them. Partly, it meant fostering democracy. A parliament and a president re-emerged; there were elections.
Much went wrong in a pretty public way. The “government” served as a device for corruption, much of it at the expense of American taxpayers. From their safe-haven in Pakistan’s border areas, the Taliban rebuilt its military power, then began attacks inside Afghanistan. They targeted the government’s shoddy security forces. They also attacked American outposts in the Northeastern part of the country. These attacks couldn’t be called Taliban victories, but they did give the Americans a sense of the nature of their opponent.
President Barack Obama inherited this mess, then tried to extricate America from Afghanistan. First, he “surged” almost 100,000 American forces into Afghanistan in time for the Summer 2010 “fighting season.” This did little to back-down the Taliban. American generals began to express their belief that the war needed a diplomatic solution. In May 2011, Special Forces finally killed Bin Laden in his Pakistan refuge. In June 2011, President Obama announced that American forces would transition to a training and support mission.
President Donald Trump inherited this mess, then tried to extricate American forces from Afghanistan. In 2018 it began negotiations with the Taliban, but without the Afghan government. These negotiations concluded successfully from the point of view of the Americans and the Taliban. In February 2020, an American-Taliban deal agreed that all American forces would be gone from Afghanistan by 1 May 2021. Meanwhile, the Taliban agreed to cut ties with Islamic radical organizations, dial back its attacks on Afghan government forces, and negotiate with that government.
Relations between the Americans and the Afghan government went further down-hill after this deal. The Taliban, which knew that they had won, proved unbending with the government, which knew that it had lost. Nor did the Taliban check the violence very much. Taliban forces have evicted government forces from much of the country and are taking control of local government and the roads
American security experts predict that the country will be under Taliban rule within two to three years after American forces depart. President Biden then set the final departure date for 11 September 2021. This is how endless wars end. Better to ask how they start.
 David Zucchino, “America’s War in Afghanistan: How It Started and How It Is Ending,” NYT, 23 April 2021.
 OK, not actually taxpayers. The US put the wars in Afghanistan and Iraq on the credit card.
 See, for example, https://mwi.usma.edu/podcast-the-spear-combat-in-the-kunar-river-valley/