Political polarization and selection in representative democracies