I think Hillary lost a lot of the youth vote, which usually carries the Dems across the aisle. Particularly the young black vote. Her ties to the prison industrial complex and mass incarceration, Black Lives Matter's games and ties to the Dems. Other corruption that raised questions about her ethics.
I don't think Trump had a great campaign, but it was effective against her corruption and somehow worked. Surprised me
The young liberal vote didn't turn out for Hillary because of what her minions did to Bernie Sanders. (By the way...giving Debbie Wasserman Schultz a spot in your campaign after her being run out of the DNC leadership on a rail has to rate up there as one of the stupider political moves ever made when supporters of Sanders were that incensed over what DWS had orchestrated.) The black vote didn't turn out for Hillary because she's a 70 year old white woman and not Barack Obama. The union vote didn't turn out for Hillary because they didn't see solutions being put forth by her that would put them back to work.
You were only "surprised" because the main stream media led you to believe things that were never true...like she had a big lead over Trump.