Why protract a war? [...] The enemy is strong and we are weak, and the danger of subjugation is there. But [...] the enemy's advantage can be reduced and his shortcomings aggravated by our efforts. On the other hand, our advantages can be enhanced and our shortcomings remedied by our efforts. Hence, we can win final victory and avert subjugation, while the enemy will ultimately be defeated.
Mao-Tse-tung, "On Protracted War"
The essence of protracted warfare doctrine is not to prolong a war out of respect for some mythical oriental principle, but rather to prolong it in order to avoid defeat.
We can conclude, then, that generally, the stronger side in a war seeks to shorten the duration of the conflict, while the weaker side generally tries to lengthen it in order to increase opportunities for a favorable outcome. [...] The stronger side is more apt to seek a clear beginning and ending to a war as well. The stronger side, not necessarily always the aggressor, usually wants to limit the expenditure of means (including time) in the accomplishment of its ends. [...] as a result, we must be careful when we make assumptions about duration in war.
Robert R. Leonhard, "Fighting by Minutes"
Combine this with what I wrote about repertoires and you have a full explanation of why the stupid conflict in Afghanistan is in its eleventh year already.
The best way out of such a conflict with such a protracting opponent is modesty in demands and a negotiated end to the conflict.
The second best way is to simply go home - if you can.
The third best way is to fool the enemy about the relative strength, provoke him into entering the last stage of conflict and dare a general offensive. This is applicable to Afghanistan as well, but apparently way too much strategy for our dumb alliance.