The second time he ran for president, John McCain tried to repair relations with powerful elements of the conservative base he had once called “agents of intolerance.”