A huge turnout helped Mr. Rouhani, with Tehran registering twice as many votes as in 2013