Once viewed as a centrist with potentially broad appeal, the former Massachusetts governor was compelled over two presidential campaigns to shift far to the right, particularly on immigration, in a way that alienated many Hispanic and centrist voters.