For the second week in a row, there was a temporary glitch in the Associated Press' election night data.
Today, that glitch was to Hillary Clinton's favor, showing her with 2,000 more votes in Vigo County, Indiana, than she actually had. That gave Clinton a giant margin in early returns, vastly at odds with what exit polls showed - and far bigger than the 7-point margin she enjoyed in the final polling average from Real Clear Politics.
Within minutes, the wrong numbers in Vigo County were erased, and, over the next hour or so, Clinton's remaining lead started to vanish. It wasn't until about two hours after polls closed -- at about the same time that Ted Cruz dropped out of the Republican race, all-but-handing the nomination to Donald Trump -- that the race in Indiana was called for Bernie Sanders. He'd beaten the polls, as he did in nearby Michigan -- and probably, once all the votes are in, by a wider margin.
After losing five of six races over the last two weeks and only winning the small state of Rhode Island, the Indiana win was no doubt a welcome psychological boost.
But why did Sanders win Michigan and Indiana, while losing other Midwestern states like Missouri (narrowly), Illinois and Ohio?
Unlike in the Republican contests, there have been pretty consistent patterns that have defined the Democratic match-ups. Bernie Sanders consistently does better with younger and more liberal voters; Clinton does better with older, more moderate and black voters.
In Indiana, preliminary exit poll data reported by CNN showed that the electorate in the state was more likely to identify as liberal than in other Midwestern states, and less likely to identify as moderate. What's more, the change since 2008 was much larger than in those other states.
But Sanders also won Michigan, where there were relatively few voters who identified as liberal.
The best predictor of outcomes to date is how many black voters came to the polls. There's been a correlation between how many black people live in a state and how well Hillary Clinton has done there, an effect that's slightly stronger in states with closed primaries (meaning that independents, who strongly back Sanders, can't vote).
Today the percentage of the electorate that was black was slightly lower than the average of all contests for which we have polling data so far, but not dramatically so. Black voters preferred Clinton by a 3-to-1 margin. But white voters -- nearly three-quarters of the electorate -- leaned heavily toward Sanders, giving him nearly 6 in 10 of their votes. (On average so far, the two have been equally matched, about 50-50.) Sanders also did better with the upper end of the young-voter bracket, a group that turned out more heavily than they did in 2008. Those two shifts made the difference.
It wasn't totally unexpected that Sanders would pull out a win in the state, despite the polls being against him. FiveThirtyEight's model, which looks at racial composition and the type of primary, figured that Sanders would win by 7 points -- slightly more than where it is right now.
Despite Sanders's win, and despite slightly narrowing the delegate gap with Clinton, Sanders' position for winning the nomination actually got worse. He needed, by our estimates, to win 64.9 percent of the delegates to stay on track to pass Hillary Clinton. He'll end up getting somewhere around 53 percent of them, if current figures hold. Meaning that he'll need even more of what remains in order to possibly pass Clinton's pledged delegate total -- demonstrating again why doing so is a nearly impossible feat. (The Indiana results also made it impossible for Sanders to clinch the nomination with pledged delegates.)
What's particularly remarkable about the night's results is that Donald Trump was expected to win, did, and knocked Ted Cruz out of the race. Hillary Clinton was expected to win and didn't, and Bernie Sanders soldiers on despite underperforming on the delegates he needs in order to win and despite the fundamentals of the Democratic race having not changed in nearly two months.
Part of that loops back to the way the Democratic race is divisive in the way the Republican race isn't. There are very passionate groups of supporters for Bernie Sanders that want him to keep fighting. So he'll keep fighting.
And, as with today, occasionally winning.