First of all, surrendering requires a specific flag on the unit. Therefore it only works on some mods, since vanilla naturally doesn't have this flag. And in those mods, some units may be eligible for surrendering, and some not.
If a unit is eligible, then it's enough to either panic/berserk it or make it unconscious. Then it will surrender as soon as there are no non-surrendering enemy units left.