Cook County Chief Administrative Officer Robin Kelly started out as one in the crowd of Democrats looking to replace former Rep. Jesse L. Jackson Jr., D-Ill., in Congress.

But in the final weeks before Tuesday’s primary, Kelly climbed to the front of the pack.

The 2nd District special election remains unpredictable — mostly due to anticipated miniscule turnout in frigid Chicago winter. But it’s clear a combination of strategy, luck and super PAC spending broke in Kelly’s favor, allowing her campaign to control much of the narrative in the race.

During the weekend, state Sen. Toi Hutchinson left the race and backed Kelly. As a result, the path for the rest of the top-tier candidates — former Rep. Debbie Halvorson and Alderman Anthony Beale — has narrowed.

“Kelly’s campaign has been good in recognizing issues and acting on them quickly with good messaging and outreach to voters and supporters alike,” said Kevin Lampe, a Democratic consultant from Chicago who worked on Jackson’s campaigns. “Good campaigns are prepared to take advantage of opportunities as they are presented.”

Kelly boasted a double-digit lead over the field in Hutchinson’s internal polling — an automated survey taken before she exited the race, according to a source familiar with it.

Of course, Kelly had help along the way — more than $2 million worth of it. New York City Mayor Michael Bloomberg’s PAC topped that figure in advertisements in the race. Most of the ad campaign blasted Halvorson’s previous support from the National Rifle Association, but the PAC also criticized Hutchinson for similar backing.

In the final weeks, Independence USA PAC’s went all out and boosted Kelly. Halvorson and Beale revolted, accusing Kelly of coordination. But it’s difficult to see how their cries will compete with the millions of dollars of pro-Kelly advertisements — the only televisions spots in the race.

The course of the race has changed dramatically over less than two months. At the start, black Democrats in Chicago feared an inevitable Halvorson victory. They believed the black candidates would split the field and that her base on the district’s south end would deliver her the nomination with possibly less than 20 percent of the vote.

That scenario has became increasingly unlikely with each passing week. It’s a case of simple math: With fewer candidates running for the Democratic nod, the winner will have to get a larger share of the vote, perhaps more than 35 percent, to win.

Nonetheless, Halvorson repeatedly referred to herself as the front-runner in a Friday phone interview, describing how she is constantly “swarmed” by supporters on the campaign trail.

“When you’re in the lead and you have the highest name ID, people are going to always try to knock you down,” Halvorson added. “You expect some of this, but you never expect that one billionaire is going to try and come in and buy a House race.”

Gun control dominated the issues debate in the 2nd District years before it entered the national discussion after the Newtown, Conn., school massacre. The district includes much of Chicago’s south side, which has experienced a dramatic spike in gun violence in recent years.

This hurt Halvorson, who was forced to reconcile her support for Second Amendment rights throughout her campaign.

On Saturday, Halvorson announced she would attend a conceal-and-carry class on Saturday, for example. She insisted the issue is politically helpful to her among women who want to carry guns for protection.

It’s the not first time Halvorson has had to grapple with guns in this district either: Last year, Jackson ran a devastating advertisement highlighting Halvorson’s gun control record when they faced off in the primary.

But this time around, the gun control ads were more plentiful — and brutal.

“They’re over the top,” she said of the Bloomberg PAC ads. “People are with me. Our phones ring off the hook. There are Facebook posts.”

But the political forces are working against Halvorson. The Service Employees International Union has sent out 16,000 direct-mail pieces in the district that are critical of Halvorson.

Kelly has been on the air as well, and Halvorson’s fundraising has not been strong enough to answer on the airwaves. But while television is central to any modern campaign, this race is about getting bodies to the polls in the middle of the Chicago winter.

Beale’s team is counting on his Chicago base as the only candidate hailing from the urban part of the district. His team is betting on loyalty and turnout from a base of senior citizens — but local strategists say it’s unlikely he can win.

“They [voters] have to have a compelling reason to turn out for you, and that’s a totally different campaign model than a presidential year or any year when there’s anything else on the ballot,” a Chicago Democratic strategist said. “You have to take a different approach when you’re the only race on the ballot.”

But even luck has been on Kelly’s side. She drew the top slot on the ballot. Halvorson will be third from the bottom.