As you may or may not know, your vote doesn't actually choose who winds up at 1600 Pennsylvania Ave (or across the street in Trump's new hotel for that matter). Don't freak out! Your vote doesn't elect the president or vice president directly, but it does still matter. You should still vote. But the way it works is that by casting a vote for president and VP, you're choosing which party from your state elects electors to the Electoral College — say that five times fast. They in turn elect the president. So has an elector ever changed their mind?
In other words, has an elector changed sides and voted for another party or candidate? Yes, actually, and it's not all that rare. There's even a name for it: "a faithless elector." But before you cry into a puddle of election frustration, hear me out. In the last 40 years, it has been relatively uncommon — more often a mistake or a protest vote when the winner of the election was clear. It hasn't been the decisive vote ever. Even the one time that it did come close to mattering, it was the vice presidential vote — and the U.S. Senate voted for the guy was pledged the votes. That was in 1836.
The last time an elector voted for the candidate of another party (as opposed to making a mistake, voting for someone else in the same party, or not voting) was in 1972. That was when Roger MacBride, a pledged elector for the Republicans (Richard Nixon for president), decided that he would instead vote for the Libertarians (running was John Hospers). He wrote a book on the system and said that he did it because it was intended that its members act in the best interests of the republic, regardless of faction."
Given Trump, it's definitely something to keep in mind. And even though some would argue it's a vestige of an outdated system and there's the chance that it could hurt Trump, imagine if you do support the candidate who is being denied their due votes. Just four years ago the election seemed much less contentious, and still this was a concern among some Republicans. Just like now there's the #NeverTrump folk, that year there were electors that might be considered #ForeverRonPaul. They gave interviews at the time acknowledging they might "go rogue" à la Palin and vote for their preferred Paul.
Some 29 states have laws that prevent — or try to prevent electors from doing this. They might not be constitutional (that's another matter — they've never been enforced) but there's definitely the expectation that the electors will vote for who they're supposed to... even if there's always the chance that they won't.