If you want someone to quote actual bits of code, I'm more than happy to oblige.
When a unit can retreat from a melee attack, the game first takes the unit's base withdraw chance (80% for Slingers) and then subtracts 20% for each max movement point the attacker has above 2: eg. if a Knight attacks a Slinger, a -40% modifier is applied to the withdraw chance by default because Knights have a max movement range of 4, thus (4 - 2) * -20% = -40%. Note that this means units with a max movement range of 1 actually ADD 20% to the unit's withdraw chance (movement range of 0 wouldn't do anything), provided the unit has some base withdraw chance in the first place. The game then checks whether any of the three hexes on the far side of the attack are blocked (eg. if the attack happens from the NE, the directions checked are SW, SE, and West, in that order) and subtracts another 20% for each blocked hex; if all three hexes are blocked, the unit can never retreat. The game then rolls a random number between 0 and 99 inclusive, and if the roll's result is less than the withdraw chance, the unit withdraws to an adjacent tile by a random left-right bias and a bias to move away from the incoming attack (eg. if the attack happens form the NE, the bias is SW first, then West and SE, then NW and East). Note that even though the game technically lets retreats happen to plots adjacent to the original attacker's, units should never actually retreat to those plots, as they have the lowest priority when other plots are available, and when no other plots are available, the game forces the withdraw to not occur, even if the unit would have a 100% withdraw chance, since all 3 plots on the far side of the attack are blocked.
Forced retreats (from Winged Hussars) happen in a similar fashion, only it happens after the damage calculation goes through with a 100% chance of happening if at least one of the 3 plots on the far side of the attack are available.
I do not see any bit in the code that forces units to only ever withdraw from maximum one attack per turn. Provided all the necessary conditions are met (attacker is always a slow unit, hexes to be retreated to aren't blocked), there should be no reason why a unit with a withdraw chance would not be able to withdraw from multiple melee attacks in a single turn.
Relevant code bits to check are CvUnitCombat::Attack(), CvUnit::CanWithdrawFromMelee(), and CvUnit:: DoWithdrawFromMelee(). The basic structure is that within CvUnitCombat::Attack(), if the CvUnit::CanWithdrawFromMelee(attacker) call on the defender unit returns true, CvUnit:: DoWithdrawFromMelee(attacker) is called on the defender unit, as well as a supplementary CvUnit::UnitMove() call on the attacker unit to move into the vacated plot if it can.
Minor note, but Impis' first strike attack still goes through, even if the defender would withdraw from combat.