About four years ago, I started watching the site FiveThrityEight on a consistent basis, because it offers a fascinating look into the world of polling and statistics. They also cover sports odds, having been acquired by ESPN in 2013, which is in some ways a fairly terrible metaphor for the thing that politics has become for a lot of people (a sports rivalry). Founder Nate Silver generally had a pretty good track record for predicting outcomes of elections, and before the results starting coming in on that November, 2016 evening, their prediction models basically said that Trump had a 1 in 4 chance of winning the election.
Naturally, he took a lot of heat for that, but a 1 in 4 chance is not no chance. Given the room for polling error in a tight election, the outcome was always on the table. Basically, they take polling data, weight it for reputation and quality, adjust and compensate for other factors that they observe, and then run 40,000 simulations to see what could happen. Their current prediction model shows Trump winning 13 out of 100 times, which isn't great, but still wholly terrifying.
If you haven't figured it out, there are 538 electoral votes, and you need half plus one to win the election. The site does a pretty good job of explaining poll science, and this year how it has changed. The industry has changed dramatically over the years, in part because the old days when it relied entirely on random phone sampling are gone. They've also had to figure out how to account for layers of mistrust toward pollsters and dishonesty among those being polled. And then if that weren't enough, they have to account for the fact that people are voting over the course of almost a month, so if there are changes in the numbers, they have to account for that. I'm not a math geek, but I find it all very fascinating. Changes in culture and technology have vastly changed an entire industry.
On election night, they will update the model as results come in. According to the current forecast, the only way it starts moving in Trump's favor is if there are surprises in Nevada, Michigan and Minnesota, which are close enough to the margin of error that they could swing things. Wisconsin, Pennsylvania, Arizona and Florida are even more questionable, but the same could be said about Georgia, Texas and Ohio from the other side.