Matthew Yglesias dispells this oft repeated phrase in a brilliant short post.
It starts out with Clausewitz's classic book On War home of the famous aphorism that "war is the continuation of politics by other means." There's actually a very good reason why Clausewitz is so famous and why this line, in particular, is famous. "Politics" in contemporary usage tends to denote "partisan politics" or "electoral politics" so perhaps it's better to think in terms of the word "policy." The point here is that going to war, prosecuting a war, continuing a war, ending a war, etc., are all policy decisions. They are policy decisions undertaken to achieve policy goals. The goal of the VC/NVA military campaign was to persuade the United States of America to stop backing the Republic of Vietnam regime in order to precipitate the collapse of the ROV government and unite the Vietnamese nation under the leadership of the Communist government in Hanoi.
The Tet Offensive did not, on its own, accomplish any of those things. It did, however, achieve major strides in that direction. It was, therefore, a success. It wasn't a "military" failure but a "political" success, it was just a success. There are no military failures that succeed politically, nor military successes that fail politically. All military operations are policy initiatives, and the only criterion for success or failure is success or failure in achieving policy objectives. [...]
You see this not only in the conduct and discourse of war supporters, but in some characteristic modes of criticism. The oft-repeated phrase that Bush had a "plan to win the war" but lacked "a plan to win the peace" is a manifestation of the same problem. Wars are undertaken to achieve policy goals. The policy outcome of a war is determined by the state of the peace -- the end of the war. If you don't have a plan to achieve your objectives, you don't have a plan to win the war at all. When you invade Afghanistan and manage not to achieve most of your key objectives -- the capture or killing of the al-Qaeda/Taliban leadership and bringing the entirety of Afghan territory under the control of anti-al-Qaeda forces -- you didn't "win the war" but then screw some stuff up. You lost the war. If your goals in Iraq were to (a) eliminate Saddam's nuclear program, and (b) construct a stable, pro-American regime in Iraq, and it turns out that Saddam had no nuclear program and you can't construct a stable, pro-American regime in Iraq, you've lost the war.