Prior to actually running, Hillary went around to all the potential candidates and asked them not to run. She arranged with the party funders and other influencers to get their support and endorsement. This kept potentially stronger candidates like Elizabeth Warren and Joe Biden out of the race.
Remember that Bernie Sanders originally ran less to win than to convince the Democrats to make changes to their platform. It was only over time and viewing the substantial support available that he took the possibility of winning more seriously.
It's also worth noting that prior to running, her support was much stronger. As recently as 2013, she had a general approval rating (among all voters) of around 65%. As recently as 2015, she had an approval rating among Democrats of 86%. It wasn't until Bernie Sanders and Donald Trump started seriously criticizing her that her approval rating fell to the low levels (less than 50% and 77% respectively). She also may have been hurt among independents and moderate Republicans by rejecting the Bill Clinton legacy of moderation in favor of a more Sanders-like platform. Of course, she also faced Donald Trump who was himself rather unpopular.