Keir Starmer announced his resignation after facing growing pressure to hand over to a new leader who can try to revive the government’s flagging fortunes