Pete Buttigieg, the 38-year-old former mayor of South Bend, Ind., who saw a meteoric rise from virtual unknown to top-tier contender and became the first openly gay candidate to make a high-profile presidential run, ended his campaign Sunday as he confronted the reality that his prospects of victory had all but collapsed.