After a long, often contentious, and surprisingly successful primary campaign, Bernie Sanders endorsed Hillary Clinton for the presidency on Tuesday morning at a New Hampshire rally.

"Secretary Clinton has won the Democratic nominating process, and I congratulate her for that. She will be the Democratic nominee for president and I intend to do everything I can to make certain she will be the next president of the United States," Sanders said.

"I have come here to make it as clear as possible as to why I am endorsing Hillary Clinton and why she must become our next president," he continued. In his speech he went on to sharply criticize Donald Trump, and praised Clinton for understanding the nation's economic challenges, supporting a public option for health insurance, and listening to scientists on climate change. You can read his full prepared remarks here.

Now, Sanders didn’t announce that he was suspending or ending his own campaign. He said that the delegates’ roll call at the convention in a little over two weeks would reflect that he had won almost 1,900 delegates — suggesting that he might technically stay in the race till then.

But regardless, his endorsement of Clinton finally brings the Democratic primary to a close, and helps unify the party around the shared goal of defeating the Republicans and their presumptive nominee, Donald Trump.

The endorsement comes after a campaign in which Sanders has had quite a lot to be proud of. After starting as a little-known underdog, he ended up winning 22 states, nearly 1,900 delegates, and more than 40 percent of overall votes cast in the Democratic contest.

He also built a remarkable small-donor fundraising apparatus, got millions of young people involved in politics, and proved that "socialist" is no longer a dirty word among Democratic primary voters.

In the end, however, he was undone by his failure to sufficiently expand his appeal among the black and Hispanic voters who make up so much of the party's coalition. With Clinton winning so many states with large black and Hispanic populations in landslides, the delegate and demographic math just didn't add up for Sanders.

But don't expect this to be the end of Sanders-ism. Though he may have lost, his surprisingly strong performance shows that much of the party's base, especially young people, quite like a "democratic socialist" economic agenda. Indeed, it's quite possible — though far from certain — that the Sanders platform could be the future of the Democratic Party.

An improbable campaign

Sanders is now nationally famous, one of the most prominent figures in American politics, and arguably the leader who's most trusted by a wide swath of the Democratic Party's voters.

But a little over a year ago, he was a mostly obscure backbench senator representing a tiny state, mostly known for his quirky self-identification as a "socialist" and his longtime refusal to outright join the Democratic caucus.

By September 2014, he was considering running for president but had deep misgivings. "I have to be realistic," he told a town hall crowd in Waterloo, Iowa. "I don't want to run and make a fool of myself, or, most importantly, do a disservice to all of the ideas that are needed. Believe me, if I ran with this program in a campaign and did very poorly, it would be a disservice to those ideas."

Yet Sanders said he felt that, "Coming from the working class, our people are facing enormous problems. And their needs have not been addressed. People are not standing up for them." The Democratic Party, he continued, had "moved from a center-left party to a centrist party," when in fact a bolder challenge to the power of corporations and wealthy was needed.

Sanders's ambitions were enormous — he hoped to pull off what he called a "political revolution," using a platform of economic populism to motivate nonvoters to turn out and pry some Republican voters over to the Democratic side. "You've got to take your case to the American people," he told me then at a cafe outside Waterloo. "You've got to mobilize them and organize them at the grassroots level in a way that we have never done before."

The Vermont senator argued that his positions — critical of the wealthy and corporate power, supportive of campaign finance reform, skeptical of trade deregulation and cutting social services — had the support of most Americans. And he said that tapping into that energy would be the way to win at the polls.

The rise of Berniementum

So, when Sanders announced his campaign in April last year, he set about trying to do just that. Months of hard work and campaigning in Iowa and New Hampshire ensued — but, especially early on, it was rarely rewarded by media attention, since Clinton was blowing out Sanders in the polls.

Political elites blithely assumed that a "democratic socialist" could never succeed in American politics. Clinton locked up endorsements from practically every big name in Democratic politics, which suggested to some political scientists that she had the race in the bag. Washington pundits spent their day speculating that only a campaign by Vice President Joe Biden could make the Democratic race competitive.

Yet it gradually became clear that Sanders was really tapping into something. The crowds he managed to turn out to his rallies were enormous. They were also quite young — many left-leaning millennials were drawn to his liberal views, his challenge to the Democratic Party's establishment, and even to his personal quirkiness and seeming authenticity.

"A lot of kids my age, nobody wants to talk about politics; they say it doesn't matter," college student Philip Commins told me at a Sanders event in Boone, Iowa. "But when you vote for Bernie, it does matter. Because he's not saying this stuff to get elected. He's not just parroting what people want to hear."

And the money poured in too — $73 million in 2015 alone, and tens of millions more afterward, almost entirely from small donations. Sanders ignored the traditional Democratic fundraising networks, showing instead just how potent small-donor fundraising can be.

He began to creep upward in the polls, passing Clinton in New Hampshire and coming close to her in Iowa. Other Democratic candidates like Martin O'Malley and Jim Webb became afterthoughts, as the race quickly transformed into a two-way contest between Clinton and Sanders. When Iowans went to caucus on February 1, Sanders came away with a virtual tie for first.

And the following week, he blew out Clinton in New Hampshire — beating her by 22 points and making even some of the biggest Sanders skeptics wonder whether he could really pull this thing off.

Why Sanders fell short

Back in June 2015, I laid out seven hurdles that any challenger to Clinton had to surmount in order to replicate Barack Obama's surprising 2008 upset.

And Sanders ended up surmounting a great many of them! He surged in Iowa and New Hampshire, he built an incredible small-donor fundraising operation, and he demonstrated the organizing muscle necessary for racking up delegates in small states and caucuses.

But there was one problem that Sanders could never solve: He simply did not win over enough of the black and Hispanic voters who make up such a large share of the Democratic electorate. The Sanders coalition was overwhelmingly white in a Democratic Party that isn't.

Perhaps that's because Sanders has represented an overwhelmingly white state for his entire decades-long career in national politics, or perhaps it's because the Clintons personally had built up more credibility among nonwhite voters. (It's notable that among younger black and Hispanic voters, Sanders did far better.)

Whatever the reason, the consequence was that Sanders got absolutely blown out by Clinton in the Deep South and in states with large Hispanic populations like Texas and Arizona. And since all Democratic contests allot their delegates proportionally, those landslides really mattered. They helped Clinton build up a sizable delegate lead that Sanders just couldn't overcome unless he started winning big, diverse states in landslides. And he never managed to do that.

In my view, Sanders didn't lose simply because "the party" backed Clinton or blocked him somehow. Indeed, he did extraordinarily well despite all that, and just couldn't overcome some demographic headwinds.

But he created a new model of Democratic politics that other candidates could follow in the future. It's quite conceivable that against a more divided party establishment, a candidate with more appeal to nonwhite Democrats could do quite well with Sanders's platform. So though the Sanders campaign is over, don't expect this to be the last we hear of Sanders-ism. It will likely shape the Democratic Party for years to come.

Bernie Sanders' accent, explained