Ada is a complex computer algorithm that the campaign was prepared to publicly unveil after the election as its invisible guiding hand. Named for a female 19th-century mathematician — Ada, Countess of Lovelace — the algorithm was said to play a role in virtually every strategic decision Clinton aides made, including where and when to deploy the candidate and her battalion of surrogates and where to air television ads — as well as when it was safe to stay dark.

The campaign's deployment of other resources — including county-level campaign offices and the staging of high-profile concerts with stars like Jay Z and Beyoncé — was largely dependent on Ada's work, as well.

While the Clinton campaign's reliance on analytics became well known, the particulars of Ada's work were kept under tight wraps, according to aides. The algorithm operated on a separate computer server than the rest of the Clinton operation as a security precaution, and only a few senior aides were able to access it.

According to aides, a raft of polling numbers, public and private, were fed into the algorithm, as well as ground-level voter data meticulously collected by the campaign. Once early voting began, those numbers were factored in, too.

What Ada did, based on all that data, aides said, was run 400,000 simulations a day of what the race against Trump might look like. A report that was spit out would give campaign manager Robby Mook and others a detailed picture of which battleground states were most likely to tip the race in one direction or another — and guide decisions about where to spend time and deploy resources.

The use of analytics by campaigns was hardly unprecedented. But Clinton aides were convinced their work, which was far more sophisticated than anything employed by President Obama or GOP nominee Mitt Romney in 2012, gave them a big strategic advantage over Trump.

So where did Ada go wrong?

About some things, she was apparently right. Aides say Pennsylvania was pegged as an extremely important state early on, which explains why Clinton was such a frequent visitor and chose to hold her penultimate rally in Philadelphia on Monday night.

But it appears that the importance of other states Clinton would lose — including Michigan and Wisconsin — never became fully apparent or that it was too late once it did.

Watch more!

Clinton made several visits to Michigan during the general election, but it wasn't until the final days that she, Obama and her husband made such a concerted effort.

As for Wisconsin: Clinton didn't make any appearances there at all.

Like much of the political establishment Ada appeared to underestimate the power of rural voters in Rust Belt states.