Zohran Mamdani's election as New York mayor caps an extraordinary rise for the leftist local lawmaker who emerged from relative obscurity to lead a supercharged campaign for the US megacity's top job.