Résumé : We present a model of electoral competition in which parties act as brands and use competition to select their candidates. We show that the forces that shape the competition between party representatives and independents rationalize the positive correlation between inequality and polarization documented by McCarty, Poole and Rosenthal (2006) for the US. We also show that, when voters are badly informed about the quality of candidates, it is optimal for party to use primaries to get an edge on independent candidates. This rationalizes the introduction of the American direct primary in the US at the beginning of the twentieth century.