Despite sky-high inflation, the earthquakes and a tough climate in the election race, a mercurial Erdogan who has vexed his Western allies while tightening his grip on the Turkish state was granted five more years, becoming Turkey’s longest-serving leader.