On the eve of the New Hampshire primary in February, a longtime aide to Bill Clinton was worried. Hillary Clinton was about to go down to defeat in the state, and the former president was despondent.

“He’s losing it bad today,” Mr. Clinton’s chief of staff, Tina Flournoy, wrote to John D. Podesta, Mrs. Clinton’s campaign chairman, in an email. She added, “If you’re in NH please see if you can talk to him.”

The email was one of thousands released by WikiLeaks on Monday that provided a revealing glimpse into the inner workings of Mrs. Clinton’s campaign. They show a candidacy that began expecting a coronation and was thrown badly off course by a misreading of the electorate and a struggle to define what she stood for.

Stretching over nine years, but drawn mainly from the past two years, the correspondence captures in detail the campaign’s extreme caution and difficulty in identifying a core rationale for her candidacy, and the noisy world of advisers, friends and family members trying to exert influence.