More people wanted HRC, though. That's how elections work. It doesn't mean the loser is unpopular or broadly disliked. It means there's another candidate voters like better (or dislike less).
Laws. Traditions. Elections have always been managed on a state-by-state basis in the US, which is why my nice competent Minnesota that runs excellent elections is held hostage on a national level by borderline banana republics like Ohio and Florida, where ballot boxes out of the back of someone's car are considered normal.
It’s easy to bash the DNC’s joint fundraising agreement with Clinton, or the leaked emails showing that DNC staffers were supportive of Clinton and frustrated by Sanders. The DNC is meant to be a neutral presence in party primaries, and even minor deviations from that position are affronts.
The harder question in the larger one: What role should party elites play in primaries? It wasn’t that long ago, after all, that they fully decided primaries, meeting in smoky back rooms during the political conventions to hash out the next nominee. Before 2016, the reigning political science theory of primaries was called “the party decides,” and it argued that political elites still largely decided party primaries, albeit through influencing voters rather than controlling convention delegates."
I think it is quite obvious that the DNC did everything in their power to get rid of Sanders and put HRC into position. The problem was that she was unelectable and many Bernie voters just decided that Trump will be a better president than HRC (and many unfortunate other things, like HRC's popularity went down after every public appearance, all the left leaning social media declared HRC president, etc.).