Sixteen years ago the U.S, invaded the country and decided to eliminate the ruling Taliban for something that was planed elsewhere by a different group. Since the invasion the U.S. tried to defeat the Taliban. It has lost that fight. As soon as it leaves Afghanistan the Taliban will be back in power. But no one is willing to pull the plug on the nonsensical military approach.
The Taliban are part of Afghanistan and a significant segment of the population supports them. When the U.S. invaded Afghanistan it put the brutal and utterly corrupt warlords back into power. These were exactly the people the Taliban were created to hold down and the reason why they could take power in the first place. While demanding a strict religious life the Taliban successfully took care of local security and eliminated the lawless and corrupt rule of the warlords.
It is no wonder then that a large part of the population wishes to have them back in power.
The U.S. supported government in Kabul is utterly corrupt. The Afghan military and police the U.S. pays is likewise only motivated by money. It is not willing to fight. It takes high casualties during Taliban attacks and therefore avoids contact with them whenever possible. Some 60 % of the country is now more or less back under Taliban control. The government's say is restricted to the bigger cities.