The shape of the mayor’s race in November and the future of Andrew M. Cuomo are now in flux after Zohran Mamdani’s performance on Tuesday.