As the Democratic and Republican national conventions approach with a still-contentious primary season raging on, the possibility of not having a clear nominee is looming. It's been a while since there was a contested convention for either party, so the mechanics of the event aren't widely known — and were quite esoteric to begin with. However, the rules are pretty clear when it comes to having no clear winner in the primaries. If no one gets the minimum number of delegates, the convention will simply keep casting ballots until there's a winner.
First off, the running delegate count is not a hard number; it's really more of an estimate. When voters go to the polls in their state primaries, they are really voting for the delegates, not the candidate. The delegates then get chosen at the county- and state-level conventions, meaning there are opportunities between the primary and the national convention to swing more delegates. It happened at the Colorado state convention in 2012, when Ron Paul supporters staged a coup and took a significant portion of the delegate slots, even though Paul had finished fourth in the caucus.
Now that the state conventions are happening, there's a somewhat clearer picture of what the first ballot at the national convention could look like, but even the delegates elected on the state level aren't a guarantee of votes. Many states don't have rules to bind delegates to the presidential candidate who wins their party primary, meaning they can vote for whomever they want at the convention. Although it's extremely unlikely that the results will stray significantly from the state primary results, the idea that the results can be predicted is actually a bit of an illusion.
With all that being said, if there's no winner on the first ballot, it's no big deal — the delegates will just move on to another vote. At that point, the bound delegates will be released from their obligation and can be swayed to vote for another candidate in order to bring the convention to a consensus. It opens the door for a runner-up like Ted Cruz or Bernie Sanders to sway enough delegates to win the nomination — not only a super dramatic possibility, but also one that the frontrunners must be dreading. Either way, the conventions really can't end until there's a nominee, so there's no risk of a convention so contested that the delegates never come together to elect a nominee. Many of them have regular lives to get back to and planes to catch at the end of the week, so there's incentive to just get the job done.
If no one can get the minimum number of delegates before the conventions, there are, thankfully, safeguards in place to make sure the parties can't end up totally gridlocked. Although it seems like the primary season will never end, the Republican and Democratic parties will both have their nominees by the end of July, and the country will move forward to the general election in November.