When you surround an army, leave an outlet free. Do not press a desperate foe too hard.
When a foe is cornered, they must fight for their lives and will do so with the energy of final fear. If you force them to go down in a blaze of glory they will do so, taking more of your troops than you might otherwise expend.
Also, slaughtering an army will gain you the enmity of their family and country, who will arise at a later time to take revenge. It is often better to allow a graceful retreat in the direction of your choosing. This is offering the enemy a ‘golden bridge’.
Once you have shown your superiority, you will be able to negotiate an advantageous peace.