Rise from poor shoeshine boy to the country’s highest office inspired millions in a profoundly unequal nation