We know that, at Cannae, a grossly outnumbered and outmatched Hannibal (40k infantry, 10k cavalry) managed to turn both Roman (80k infantry, 6.4k cavalry) flanks and hit them in the rear with his cavalry. Casualties were in the neighborhood of 5k for the Carthaginians, and at least half, possibly more, of the Romans killed outright. There were some Roman survivors, but no mention of a rout. Instead, the history is that the Romans were encircled, cut off, and simply cut down. Here is what does not make sense:
With such Roman numerical superiority, they had more than enough men to simply turn and face the flanks and rear. It is not like the men were blind. Their lines were very deep. The guys in the back (who happened to be the best troops, and had spears) could simply do a 180 and face the attack from the new direction. It would put them at a disadvantage, but its far from an invitation to wholesale slaughter.
Men who are highly trained, heavily armed, surrounded and fighting to the death, historically, have not ever been easy to kill. This is not a matter of breaking morale and causing a rout. Every single dead Roman had a shield and sword and knew how to use them. The idea that they could be killed at better than a 10:1 ratio by inferior troops boggles the mind.
The only explanation I have seen for the mechanics of the wholesale slaughter is that the Romans were somehow compressed in a way that made it impossible for them to fight. This is unsatisfying to me for several reasons. (1) Romans were trained to fight in dense formations to begin with, so you would have to compress them to a ridiculous extreme to get any results. (2) Only the guys at the outer edge need to be able to fight anyway, and THEY would not be compressed. Their swords and shields would still be pointing outward. (3) If anything, massive compression only results in massive counter-force, with 80,000 Romans pushing each other outward, there is no way a thin line of inferior troops is going to have the power to enforce that compression and maintain it. They'd get trampled. It doesn't matter how scared the front line Roman is if he is getting shoved like an armored human projectile into the enemy lines.
Certain kinds of weapons allow for potentially hugely mismatched kill ratios, but that isn't what happened here. This was was very short range melee fighting that the Romans had demonstrated superiority with.
So how does the historical account of the battle make sense? It is very difficult to believe that the Romans stood and fought to the death... and yet fought so poorly that they were killed at more than a 10:1 ratio. Envelopment is great for routing, but it does not magically cause men who are trapped and fighting to the death to be unable to fight. Particularly when the "trapped" men outnumber you by such a large degree, you can't claim that you are able to gain much of an advantage from the slight circumference increase you get in frontage.
You obviously have a fair handle on the physical characteristics of this ancient battle, but there are a few key corrections to be made. The numbers were probably not so lopsided, and the Romans probably did not have nearly 90,000 troops. Daly argues that total numbers of the Carth forces including cavalry, light infantry and heavy infantry may have approached 60,000, whereas the Romans probably had less than 80,000 infantry and cavalry at Cannae (29, 32).
You say there was no rout, but there was one as recorded by Livy and Appian (Livy 22.49.9, 12; Ap. Hann. 24). Many troops would have been attempting to escape, most unsuccessfully, though 10,000ish troops surrendered after some fighting at the Roman camp (198, 201). Large numbers of Romans escaped, around 14,500 according to calculations drawn from Livy (202). Many of the soldiers who died also would have done so attempting to escape rather than make any serious attempt at fighting. As such, it was not as simple as the Romans being surrounded and cut down, though that was the fate of the majority of the army.
Finally, while the Romans were trained to fight in formation, it is well known that a compressed formation was unhelpful, as soldiers with sword and shield required around a metre of space between them and the closest person to fight properly, unlike the more tightly-arranged phalanx. Roman commanders took care to make sure that space was maintained inside Roman formations, as when the individuals making up a unit became scared and naturally crowded together it had a deleterious effect on their fighting effectiveness. Caesar describes this phenomenon clearly at the Sabis in 57 BC:
"The condition of affairs, as he saw, was critical indeed, and there was no support that could be sent up. Taking therefore a shield from a soldier of the rearmost ranks, as he himself was come thither without a shield, he went forward into the first line, and, calling on the centurions by name, and cheering on the rank and file, he bade them advance and extend the companies, that they might ply swords more easily. " (Caes. BG. 2.25).
As such, a crowd of compressed men, terrified and trying to get away from the enemy by any means necessary but without the space to do so, gradually becoming more and more compressed as occured at Cannae, would physically stop many if not most legionaries from fighting particularly well (198), aside from other physical difficulties such as heat, wounds, bodies and gore all over the ground and confusion breaking up the organised Roman units. Also do not forget there would have been a constant rain of missiles on the compressed Romans, wounding great numbers of men (197-8).
As hand to hand combat, even when the issue of a battle is the balance, was so terrifying and exhausting, it was also essential to the combat motivation of ancient fighters that they have room to back away and rest, recover themselves morally, and re-engage when they're ready or the enemy force them to do so (13-5). Without this "safety distance", Sabin calls it (16), in addition to the fact that the Romans were in the midst of a catastrophic defeat and slaughter with cohesion lost in their units probably little effective leadership, their being surrounded without space to move would have been catastrophic to the psychological ability of the legionaries to fight.
Leading on from the above point however, the most important factor that must be considered in explaining the slaughter of armed men under these circumstances of course is the psychological one. Terrified and exhausted men cannot fight effectively: Daly uses the phrase "paralysed by terror" to describe this phenomenon (198). That soldiers, once terrified by the absolutely imminent specter of death, could often not fight effectively and may just passively wait for death is routinely attested to in the ancient sources under various circumstances. Here are a few examples:
Desperate Caesarian troops trying to reach the safety of a hill at the Battle of Bagradas, 49 BC:
"When all were panic-stricken and Curio understood that neither his exhortations nor his entreaties were listened to, considering that in such a pitiable plight only one hope of safety remained, he ordered them in a body to occupy the nearest hills and the colours to be transferred thither" [These were overtaken by Saburra's cav], "Then indeed our men touch the extremity of despair, and some are slain as they fly from the cavalry, others fall to the ground unwounded" (Caes BC 2.42).
Romans confused by the initial ambush at Lake Trasimene, 217 BC:
"They were charged at one and the same instant from the front, from the rear, and from the flanks, so that most of them were cut to pieces in marching order as they were quite unable to protect themselves, and, as it were, betrayed by their commander's lack of judgement. For while they were still occupied in considering what was best to do, they were being slaughtered without realizing how."
A detachment of Romans at Lake Trasimene stuck between the enemy and a lake they cannot swim due to the weight of their armour:
"For when they were forced into the lake in a mass, some of them quite lost their wits and trying to swim in their armour were drowned, but the greater number, wading into the lake as far as they could, stood there with only their heads out of the water, and when the cavalry approached them, and death stared them in the face, though lifting up their hands and entreating to be spared in the most piteous terms, they were finally dispatched either by the horsemen or in some cases by begging their comrades to do them this service. "
There are many other examples of soldiers, once surprised or terrified or deciding en masse they don't want to fight but only escape imminent death, being no longer able to fight well at all. This psychological phenomenon, where terror often makes soldiers physically ineffective in defeat, is the most important consideration in explaining how such large numbers of Romans could be killed by a far more motivated, aggressive, confident enemy who surrounded them and were advancing in tight, organised formations and still working under the orders of their officers. Once an ancient army's morale totally shatters, it is no longer an army but a crowd, and an army can easily slaughter a terrified crowd, even an armed one.
Sources:
Livy, Polybius, Caesar (Loeb translations).
Daly, Gregory. Cannae: The Experience of Battle. London: Routledge, 2002.
Sabin, Philip. “The Face of Roman Battle.” The Journal of Roman Studies, Vol. 90, 2000, 1-17.
This is (one of the reasons) why I favour Goldsworthy's reconstruction of the battle, rather than traditional reconstructions.
Under Goldsworthy's reconstruction, the Carthaginian centre broke. The resulting rush through the gap messed up a lot of the formation of the Romans and caused the Triarii to not be properly placed and formed up to turn around and face the Carthaginian cavalry.