He began his campaign last Feb. 1, the first day of Black History Month, with a clarion call for unity in a deeply polarized time. He was unrelenting in his optimism and his push for love and healing, a message he stubbornly pushed throughout the primary even as it consistently fell flat with voters energized by a fervent dislike of President Trump.

And despite introducing notable policies on gun control, criminal justice reform and the racial wealth gap, his candidacy lacked a defining issue or position on the ideological spectrum in a contest defined more by the divide between the progressive and moderate wings of the Democratic Party.

But his campaign also suffered from factors beyond its control. In a historically diverse field, Mr. Booker struggled for attention amid the excitement of new candidates like Senator Kamala Harris of California, who allowed voters to imagine a black woman as president, or Mayor Pete Buttigieg of South Bend, Ind., whose campaign as an openly gay man is also historic.

Aspects of Mr. Booker’s political life that were advantages for decades suddenly became less so. His broad fund-raising base of Wall Street bankers, pharmaceutical executives and Silicon Valley billionaires had become pariahs to many Democrats, who viewed the influence of big donors as corrosive. Rivals like Senators Elizabeth Warren and Bernie Sanders moved exclusively to small dollar fund-raising and sought to make that a litmus test for the Democratic field.

The decision to drop out of the race came over the weekend, aides said, with Mr. Booker huddling with top staff members as he wrestled with the decision. On Sunday, he told his wider staff.

The decision to drop out largely came down to finances. Despite years of relationships in the finance world of New York and the high-tech corridors of California, Mr. Booker struggled to raise money throughout 2019. All told, he collected about $22.1 million — less than Mr. Sanders, former vice president Joseph R. Biden Jr. or Mr. Buttigieg raised just in the fourth quarter.

Money was so tight that Mr. Booker had scheduled fund-raisers in the final two-week sprint of his campaign in California and New Jersey — far from the crucial battlegrounds of Iowa and New Hampshire.