A majority (over 50%) is required. If no candidate gets 50%, then they have a run-off between the two top candidates.
In the Iranian election last year, there were 7 candidates, not "hundreds". Ahmadinejad came in 2nd in the first round with 19%, and then won the run-off with 61%.
First Round:
Akbar Hashemi Rafsanjani - 6,159,453 (21.01%)
Mahmoud Ahmadinejad - 5,710,354 (19.48%)
Mehdi Karroubi - 5,066,316 (17.28%)
Mohammad Bagher Ghalibaf - 4,075,189 (13.9%)
Mostafa Moeen - 4,054,304 (13.83%)
Ali Larijani - 1,740,163 (5.94%)
Mohsen Mehralizadeh - 1,289,323 (4.4%)
Blank (no vote for president on ballot) - 1,221,940 (4.17%)
Voter Turnout: 62.66%
Second Round (run-off):
Mahmoud Ahmadinejad - 17,284,782 (61.69%)
Akbar Hashemi Rafsanjani - 10,046,701 (35.93%)
Blank (no vote for president on ballot) - 663,770 (2.37%)
Voter Turnout: 59.6%