Bottom line: China will find a way to benefit no matter what the United States does in Afghanistan. But it probably benefits more if we stay and add troops to the fight. The same goes for Russia. Because of continuing unrest in the Islamic southern tier of the former Soviet Union, Moscow has an interest in America stabilizing Afghanistan (though it would take a certain psychological pleasure from a humiliating American withdrawal).
In nuts-and-bolts terms, if we stay in Afghanistan and eventually succeed, other countries will benefit more than we will. China, India and Russia are all Asian powers, geographically proximate to Afghanistan and better able, therefore, to garner practical advantages from any stability our armed forces would make possible.
Everyone keeps saying that America is not an empire, but our military finds itself in the sort of situation that was mighty familiar to empires like that of ancient Rome and 19th-century Britain: struggling in a far-off corner of the world to exact revenge, to put down the fires of rebellion, and to restore civilized order. Meanwhile, other rising and resurgent powers wait patiently in the wings, free-riding on the public good we offer. This is exactly how an empire declines, by allowing others to take advantage of its own exertions.