Of course, I don’t know, but I can’t stop speculating.
I feel that Imran Khan convinced Trump that it was time to leave Afghanistan. Many Americans were looking for a way out anyway as they knew that winning the war and defeating the Taliban was becoming more and more impossible by the day. Trump, being a different kind of president made a deal with Imran Khan, which involved Pakistan to play a big role in moderating the Taliban.
I believe the Americans assisted the Taliban indirectly in their quick victory as they knew that the quickest way to stabilize Afghanistan was to allow the Taliban to take over. The Americans knew how the Afghan government was incapable without them to govern effectively and the Afghan army to fight the Taliban.
If it were going to be impossible for the Americans and the West to win the war against the Taliban, then what were the options available? Obviously, many permutations were theoretically possible but from a practical point of view, as far as I can see, the Americans and the West leaving and clearing out fast was the best option available to them.
If they stayed, there would be increasing diminishing returns for their investment, efforts and they would continue to experience more deaths and injuries. If they left, there could be a period of chaos and a potential return to the pre-9/11 state of affairs. The choice available was limited and the options were very risky.
Also, as the Americans had no confidence in the ability of the Afghan government and military to defeat the Taliban, then what options were still available to the Americans and their western allies. Not many.
After thinking about the complex and messy issues involved, I have concluded that the Americans decided to leave Afghanistan with full knowledge and awareness that the Taliban would take over, and decide that if so, then a speedy change would be the best. As such, they facilitated the Taliban to take over very quickly, in an indirect way, perhaps by giving signals and removing obstacles and barriers, as long as the Taliban allowed a safe exit to the western forces, foreign civilians and their local helpers and collaborators in Afghanistan.
The Americans must be working with Pakistan to minimize the negative impacts of Taliban rule in Afghanistan. And it seems that what the Americans and their western allies are doing now is PR and damage control.