Representative Debbie Dingell, Democrat of Michigan, said she told former President Bill Clinton during a visit to an African-American church in Detroit last week that Mrs. Clinton was in trouble in the state, which Democrats had thought was locked down.

“I told Bill they needed to energize Detroit, that we have a millennial problem, that the union guys are gone and that Macomb is gone,” Ms. Dingell said, referring to the blue-collar suburban Detroit County often described as the epicenter of Reagan Democrats. Mr. Trump carried Macomb County by more than 11 percentage points on the way to what appeared to be a narrow victory in the state.

As it was, Mrs. Clinton had a serious obstacle in trying to overcome one of the most powerful forces in American politics — the hunger for change that is cyclically embraced by voters — while being such a well-known figure and running for what was in effect a third term for President Obama.

“You can look at the fact that for the entire election cycle, you had a change electorate, where 60 percent of the people felt the country was going in the wrong direction,” said Anita Dunn, who served as Mr. Obama’s communications director.

Tad Devine, a senior adviser to Mr. Sanders, said Mrs. Clinton’s shortcomings had become apparent in the primary race as she struggled with Mr. Sanders in states like Michigan and Wisconsin, which she lost.

“The conventional political wisdom of insider Washington thought it knew better than the voters who still get to decide elections in America,” he said. “And it paved the way for a nominee who failed to do the one thing that a winning candidate must do — make their campaign about the future.”

Mrs. Clinton’s use of a private email server while she was secretary of state, which became one of her biggest problems this year, did not become known until after she had entered the race. But her weaknesses as a candidate were on display when she ran for senator from New York in 2000 and for president in 2008 against Mr. Obama.