As I wrote in Was Native Defeat Inevitable?(Mexican Version), Cortés barely escaped with his life during the so-called Noche Triste:
Under attack, with food and water in short supply, Cortés decided to break out of the city. Bridges on four of the eight causeways into the island city had been removed, so a portable bridge was devised. The gold and other booty stolen from the Mexica was packed; many of the Spaniards had looted as much gold as they could carry. Horses' hooves were muffled.
On the night of June 30, 1520, his large army left their compound and headed west, toward the Tlacopan causeway. The causeway was apparently unguarded, and the Spaniards made their way out of their complex unnoticed, winding their way through the sleeping city. Before reaching the causeway, they were noticed by Mexica warriors, who sounded the alarm.
The fighting was ferocious. As the Spaniards and allies reached the causeway, hundreds of canoes appeared in the waters alongside to harry the troops. The Spaniards and their native allies fought their way across the causeway in the rain, sometimes using the portable bridge to cover the gaps, although as the battle progressed some gaps had become so filled with wreckage and bodies that the fugitives were able to walk across. In some cases, the gold and equipment weighted down the conquistadores so much that they drowned.
But a recent article notes the role of disease on this particular occasion:
A germ of an idea
Thirty-four years ago, William H. McNeill, AB’38, AM’39, shed new light on world history—by giving microbes their proper place in the human drama.
By Robert Goodier
And yet, it didn't. Instead, the Spaniards conquered Mexico and converted millions of Aztecs to Christianity. "I was sort of mulling this over in my head," McNeill recalls, "and somebody casually remarked that smallpox had broken out in Mexico City the night of the noche triste"—the night of the Spaniards' retreat—"and Montezuma's nephew died of it that same night."
Cortés lucked out when no arrow hit him during his escape. He also lucked out when smallpox broke out in Tenochtitlan that night. Not only did it kill Moctezuma's nephew, it undoubtedly wreaked havoc. The one time the Aztecs needed calm and order, they probably faced a panic-inducing crisis instead.
Once Cortés escaped, he rested beyond the city. If the Aztecs had pursued him, they could've had him. But it seems they didn't have the necessary manpower or leadership. People were too busy dying to worry about Cortés.
We're talking about a turning point in world history here. If there hadn't been a smallpox outbreak that day, Cortés probably would've died. If the Cortés expedition had failed, the conquest of Mexico might've been postponed indefinitely. The epidemic hit Tenochtitlan on literally the worst possible day.
Thus we see how capricious history is. A small change here or there could've led to a markedly different outcome. The Aztec empire might've fallen anyway, but some Native nations could've survived as small independent states. Tribes in the US and Canada remained independent a century or two after first contact, and that could've happened in Mexico too.
For more on the subject, see Was Native Defeat Inevitable?