Political parties are essential to democracy--simplifying voting choices, organizing the competition, unifying the electorate, bridging the separation of powers and fostering cooperation among branches of government, translating public preferences into policy, and providing loyal opposition.
Political parties help structure voting choice by nominating candidates to run for office. Before the advent of direct primaries, in which voters determine the party nominees, the parties had more control of who ran under their label. States determine the nomination rules. While most states employ the direct primary, some use a caucus or mixed caucus system where more committed partisans have a larger role in the decision of who gets nominated.
Hope that helped :)