It was the way the Mongols waged war. They were masters at spreading terror and that reputation was well earned. And the way they got that reputation was by actual, whole-scale slaughter of people who resisted them. If a Mongol army knocks on your doorstep, you surrender. If you do so, your civilians are usually spared but the garrison will be put to slaughter. If you resist, it means death for everybody. Does not matter how small of a resistance it is. Im quoting from John Man's The Mongol Empire:
The Khwarezmian massacres were all one-off applications of a decision to use terror for strategic purposes; not genocide, the killing of a people, but the killing of towns – a tactic that deserves its own term: urbicide. It wasn’t personal or obsessive. It was dispassionate, cold-blooded murder, with one purpose: to win as quickly and as cheaply as possible.
That was their tactic. Much like other sedentary civilizations, the cities of Khwarezmid empire was huge. Bukhara, the capital had 300,000 in population. Samarkand, Bukhara, Merv and Gurganj were the most important and populous cities of the empire. Otrar was the city, where the governor who killed the trade caravan Inalchuk, was at. And when we see the fates of these cities, to the ones that surrendered and ones that resisted, we see the pattern of urbicide, as described above.
Otrar the city was left mostly alone. The Mongols had strict orders to take the governor alive and they did after a long siege. Bukhara had the same fate. The people opened the gates unwilling to die for the sultan and the garrison retreated into the Ark, the citadel. The population was enslaved but the garrison was wiped clean. Men were pressed into the vanguard to serve as cannon fodder or military service. Women and children into enslavement and the artisans pressed into service. This was the way the Mongols did things. Ortar and Bukhara were special cases due to their status. To see the Mongols warfare in action, we need to look at the other cities that were in their path.
The best case would be the comparison between Herat, which surrendered and the cities that didnt, namely Gurganj(Urgench currently), Nishapur and Merv. Herat's populace was spared except for its 12,000 strong garrison which was killed. Merv is what we will focus on since it shows the complete ruthlessness of the Mongols when facing resistance. Urgench was described as the hardest fight the Mongols faced and when the city fell the Mongols were in no mood for mercy. Quoting from the book again:
By the time victory came in early 1221, the invaders were in no mood for mercy. Citizens with any skill – 100,000 of them – were led away as captives, the rest slaughtered. Juvaini speaks of 50,000 soldiers killing twenty-four men each. That makes 1.2 million.
Merv is a very important look because the resistance wasnt huge or even considerable. In January 1221, 800 mongols arrived at its walls and probed the defenses. They were chased off but about 60 of them were captured and killed. When Genghis heard the news, Merv's fate was sealed. Part of the army was dispatched, which was about 7000 strong. They faced a garrison of about 12,000. With the Mongols terrorizing the countryside, Merv which usually had a population of 70,000 had almost 10 times that. Since they already killed the captured Mongols, they kinda knew their fate. And they bolted the doors and waited. The Mongols themselves, were only too happy to wait. For six days, they did nothing but patrol the walls. Seeing no other choice, the governor sued for peace. The Mongols asked for 200 of the wealthiest citizens just like they did in Bukhara, and took their wealth. Then, they entered the city and sat upon vengance for the killing of the Mongols by the governor. As usual, enormous care was taken to separate artisans from the general populace but they let loose their reign of terror otherwise. Quoting again:
Then the killing started. The place was ransacked, the buildings mined, the books burned or buried. Merv died in days, and lost almost everything and almost everyone. As Juvaini records, the Mongols ordered that, apart from the 400 captured artisans, ‘the whole population, including the women and children should be killed, and no one, whether man or woman be spared. The people of Merv were then distributed among the soldiers and levies and, in short, to each man was allotted the execution of three or four hundred persons.’
A cleric states that he counted 1 million and 100,000 dead in Merv after the Mongols left. Quite possibly inflated number but goes to show you the ruthless tactic of killing to spread terror that the Mongols practiced.
Source:
John Man, The Mongol Empire.
We don't know the death toll with any real reliability. But the figure you give (from Man, I assume) is reasonable, but probably high. The "quarter of the population" is probably an overestimate.
The urban population of the Khwarezmian Empire has been reasonably estimated as between approximately 500,000 and 1,000,000, with the largest cities being about 100,000 in population (Chandler and Fox, 1974; the Mongol conquest of Khwarezmia Wikpedia page quotes their figures for the major cities). These are the big cities of Transoxiana and Khorasan. These figures also suggest that the estimate of the total population might be too low, as urbanisation of 10%-20% would be extremely high for the time.
There appear to be two main causes of the devastation (which is largely civilian deaths). First, the Khwarezmian field army doesn't appear to have been large. Sverdrup (2017) estimates it as about 40,000. The total army, augmented by urban garrisons, was larger (but difficult to estimate with reliability). The Mongol army was smaller than some of the very large estimates of its size, perhaps about 100,000 (Sverdrup estimates about 70,000), but still much larger than the Khwarezmian field army. This quite likely contributed to the Khwarezmian decision to fight the Mongols by defending their cities rather than by trying to defeat the Mongols in the field. As such, much of the war was sieges of large cities, which can be very deadly for their populations. It can also be deadly for the surrounding population, as the besieging army forages, steals, or extorts food from the surrounding region. Thus, a siege-driven was is part of the explanation.
Second, the region had experienced recent warfare, with many cities changing hands between would-be rulers of the regions. Some of these cities learned the wrong lesson: that revolts against their current overlord and defection to another could improve their position. The Mongols adopted a policy of destroying such cities (which revolted after earlier submission): Balkh (which after the revolt, surrendered without fighting, but was still destroyed), Herat, Merv, Nishapur, Ghazni, Rayy, Qam (these last two having been sacked in local fighting as recently as 1220), and Hamadan (as listed by Sverdrup, who gives an excellent military history of the conquest). Some cities (e.g., Sighnaq) were destroyed after killing Mongol envoys. The only major non-revolting non-envoy-killing city destroyed was Urganj/Urgench, which required a costly 4 month siege to capture. Other cities were looted or burned, and citadel garrison massacred, but without the complete destruction suffered by the revolting cities.
The total estimated normal populations of these destroyed cities exceeds 300,000. Locals in the surrounding areas who fled into the cities would have increased that. There were deaths in the other sieges, and there would have been deaths among the surrounding population during the sieges. Also, if people tried to escape the various armies by fleeing, they ran risks of starvation and murder by bandits. But the deaths in the destroyed cities are probably a significant fraction of the total and unless the populations of the destroyed cities were greatly swollen by refugees, estimates of over a million deaths appear high.
References:
Chandler, T., & Fox, G. (1974). 3000 years of urban growth (Studies in population). New York: Academic Press.
Sverdrup, Carl. The Mongol Conquests: The Military Operations of Genghis Khan and Sube'etei. Helion, 2017
While we wait for a more specific answer, /u/cthulhushrugged wrote about the Mongol conquest of Khwarezm here.