"This confuses me. If they give everyone a chance to get out, doesn't that just give the terrorists a chance to prepare and leave as well?"
Unfortunately it does.
Since the announcement of the coming attack many of them have already moved out of the city. These things should be done silently and unexpectedly if they're to be done successfull, in my opinion.
We are in a different kind of war - in the midst of a city with terrorists that hide behind women and children and fade into the crowds.
This is the purpose of surrounding them, warning them to get out, and stretching this out. They are hoping that the displayed might will cause the insurgents to make a move, quit.
These are the Iraqi citizens and we do not help anyone by going in there and blazendly slaughtering them. We show care, we show restraint, we show all attempts to resolve peacefully. Then all blame will be on the terrorists for putting their fellow citizens in danger.