Factor 1) Vote for the party, not the candidate
According to Gallup, if you ask Americans if they are - or "lean" - Democrat or Republican, you'll find no more than about a 3% difference in the quantities. From their 2014 study:
Since the Republican Party's strong showing on Election Day last month
[after the 2014 election], Americans' political allegiances have
shifted toward the GOP. Prior to the elections, 43% of Americans
identified as Democrats or leaned toward the Democratic Party, while
39% identified as or leaned Republican. Since then, Republicans have
opened up a slight advantage, 42% to 41%, representing a net shift of
five percentage points in the partisanship gap.
So if you hypothesize that people will vote for their party, regardless of the candidate, and that both Democrats and Republicans are equally likely to overlook the specific person and vote with their party regardless, then you would expect the popular vote in the national election to follow similar results. The main difference, in this hypothesis, will be "voter turnout" - the motivation of registered voters to actually show up at the polls.
If this hypothesis is true, then elections should always be neck and neck unless someone really gets a major disadvantage/advantage.
This should be taken with a grain of salt, of course, because another Gallop study shows that 42% of people consider themselves politically independent - which I think suggests a strong social desirability bias, but you can take a look and see what you think it might mean.
Regardless, political polarization in the US has been associated with strong party-line voting, so there are many reasons to strongly consider that the elction result was heavily influenced by neither candidate offering a compelling reason to cross party lines - and voters need a compelling reason to break with their party affiliation.
Factor 2) Both candidates were disliked similarly
Every source I can find says that both Hillary and Trump were the least-liked (or close to it) US presidential candidates in history, and were constantly in a horse race to be slightly less disliked than each other (read past the headlines to get the actual numbers - polemical headliens aren't very informative). (graphic from August 2016, Washington Post)
Sometimes Hillary was slightly less disliked, and sometimes both were equally disliked, but there was no point near the election were I could find anyone reporting that there was greater like than dislike. While favorability ratings have a very imperfect relationship with election outcomes, the bottom line between vote totals and favorability ratings is that - in the aggregate - the United States citizenry were extremely ambivalent. Both candidates were seen as having severe flaws, concerns, and numerous controversies.
Factor 3) Changing party definitions
One feature of American party systems is that what defines the party group changes over time, and part of this is heavily influenced by popularity and electoral success. Every 2 years the parties actively recalibrate their message to attempt to best triangulate their constituency and strategize to win the next election cycle.
There is also no set-in-stone impediment to these changes, and the party organizers are free to shift to match the demands of a changing landscape. If something is universally popular, there is no reason both political parties can't "hug" each other and adopt them as well. This constant give-and-take, lead-and-follow exchange means that landslide success is rarely sustainable, because too many people are willing to switch party affiliations, go independent, or vote across party lines if the parties don't try to keep up.
On the net, this process - if it is real and party leadership is effective - means that elections in the aggregate will tend towards even splits. Even if the candidates are different, election results will be comparisons - and it doesn't necessarily matter to the final vote tally if they are "equally loved", "equally hated", or "equally meh", so long as they are equally whatever.
Bottom Line
Historically elections swing back and forth, and in the past 100 years you'll be hard pressed to find examples of how any one party maintained a lead in the presidential elections for more than 2-3 cycles. One could even argue that the system is becoming more "efficient", as cycles of red-blue flipping with landslide victories become ever-more-distant memories, and no party can keep the White House for long. Our system has historically been very effective at preventing long-term snowball effects in terms of party competition, at least.
But at least for now, what this has meant in the last decade or two - and in this election - is that recent US President's have approval ratings (and election results) that tend strongly towards 50%. Some have termed this a country divided, or increased political polarization, or even the result of intentional divide-and-conquery strategies to win and perpetuate power disparities - but no matter what you call it, close elections appear to be the current 'mean' from which it is hard to deviate for long. If party leadership remains pragmatic and effective (on average), and voters remain willing to pick the party that suits their interests (on average), it is unclear if this could be any other way.
median(+1, +1, +1, −1, −1) = +1
, which is just one-sided, not a representative of the whole, whilecentroid = mean(+1, +1, +1, −1, −1) = +0.2
And remember that candidates are chosen by primaries of one half of the political spectrum, so will be centrist for that sub-population, not for the general population. Open primaries probably select more centrist indistinguishable candidates.