In the U.S. the election generally goes to the guy with >50% of the vote. The laws are usually set up so that if no one gets 50%, the top two candidates have a run-off. One of those candidates is usually the incumbent, so that tends to discourage more than one serious challenger. Elections are expensive to run in, after all.
Now, you get elected. Beyond the local level, you're one of scores or hundreds of legislators. Your vote on the floor doesn't mean a lot. What does mean a lot is your committee assignments. As the eventual chair of a committee, you'll have very strong influence over what bills make it to the floor for a vote. But chairmanships are appointed by a party-line vote on the floor, so whichever party has power, they control the chairmanships.
And oh by the way, the parties have these handy fundraising organizations in place for the benefit of whoever runs on their ticket.
Practical upshot: unless you're ridiculously popular or filthy rich, the path to successfully serving your constituents lies through joining one of the two major parties.
In some other systems, candidates run "at large," and the top votegetting 5 or however many candidates are the ones elected. This means you don't need 50% of the vote to get elected, so minor-party candidates can actually succeed. And it means that no single part holds a majority in the legislature , so things like the committee appointment rules can't be done party-line.
Anyway, in the U.S., what happens is you have a two party system for a while, then one party fractures over some issue or another and a third party appears. The third party takes over the role of one of the two major parties and the displaced party fades away.