For those who voted for Mr. Rouhani, there was a feeling of tremendous relief that his challenger, the hard-line cleric Ebrahim Raisi, who criticized the nuclear deal with the United States and other Western powers, had lost.