Senator Kirsten Gillibrand was in a bind.

With less than three weeks until the deadline to get into the fall presidential debates — which she deemed crucial to keeping her campaign alive — she was on track to fall well short. She had neither the 130,000 donors she needed nor the necessary support in the polls. What she did have was a stockpile of cash. So, in one Hail Mary heave, she unloaded $1.5 million on a two-week television buy in the doldrums of August to try to improve her numbers in Iowa and New Hampshire.

“The alternative to not going all in,” said Glen Caplin, a senior adviser to Ms. Gillibrand, “was not a viable alternative.”

The gamble would prove to be a final miscalculation. If the commercials caused any discernible Gillibrand bump, it would go undetected: No Iowa or New Hampshire polls that could have qualified her were even conducted after her ads aired. On Wednesday, with the deadline just hours away, Ms. Gillibrand dropped out.

“It’s important to know when it’s not your time,” Ms. Gillibrand said in a video.

How Ms. Gillibrand, 52, so swiftly went from a rising star of the Democratic resistance and “the #MeToo senator,” as “60 Minutes” had memorably tagged her in 2018, to a 2020 afterthought and early primary casualty is a tale of mistakes, misfortune and a message that did not meaningfully hold sway in a historically crowded field.