Here's what happened. New York City is a massively Democratic City, so usually the Democratic nominee cruises to victory. The sitting mayor, Democrat Eric Adams, was mired in multiple scandals so he just doesn't bother running. The Democratic establishment doesn't have an obvious candidate and Andrew Cuomo, former New York Governor, throws his hat in the ring. Cuomo despite having resigned the governorship due to his own scandals, is considered the favorite due to name recognition and fundraising ability. He's also famously vindictive. Not wanting to risk his wrath if he wins, all of the other plausible establishment types decide to sit this one out. That left Cuomo, Mamdani, Brad Lander and an assortment of no-hopers in the primary. Lander is similar to Mamdani on issue positions but not nearly as charismatic. Mamdani and Lander cross endorse each other in the primary, which is a ranked choice election. Mamdani's votes plus the second place votes from Lander's supporters give him the nomination. On to the general election! Mamdani's opponent in the general election is previous candidate and talk show host Curtis Sliwa, that guy who wears a red beret on Fox News, because apparently the NYC GOP has no-one else. But wait! Cuomo isn't done yet and runs as an independent. Voters are now faced with the following choice: The guy who resigned the governorship in disgrace and also just lost the primary (Cuomo), a guy who won 27% of the vote in the previous election (Sliwa), or the new guy (Mamdani). Mamdani squeaks over the finish line with just under 51% of the vote.