Behind in the polls and under pressure from Andrew Cuomo, rumors about the mayor’s future had swirled for weeks.