A very good question. My guess the standard answer is to leave the country in a stable state and a friend of the U.S.
Another unrealistic answer would be: leave the country in a stable state with the terrorists vanquished. That seems to be McCain's answer. What's wrong with that you ask? We tend to play loose and free with the definition of terrorist- could be Al Queda, or it could be any Iraqi who physically opposes a U.S. presence.
However I consider the answer to be: leave the country in a semi-stable state which it currently is. Why you ask? We can't afford it. And realistically we can't bully people into liking us, can we? (although some would try.) The REAL problem is whenever we start to withdraw, some level of instability will arise. I don't consider that an adequate reason to make our occupation semi-permanent. The people of Iraq historically have had internal conflicts. Now that we've killed off Saddam, those conflicts are free to be resolved one way or the other.