Have you ever made a promise that you fully intended to keep, but then realized, upon gaining further knowledge and context, that it wasn't right to keep that promise anymore? It's like when you TOTALLY meant that you were going to be supportive when your friend started dating that guy, even though you had a weird feeling, but then you find out he's been lying to her. Members of the Electoral College sort of but don't totally have that freedom, and that's because of what happened in Ray v. Blair, the Supreme Court case that famously tackled the issue of faithless electors.
So here's what happened: In 1952, Ben Ray was the Chairman of the Alabama Executive Committee of the Democratic Party. In other words, one of his duties was to choose the electors for the Democratic Party. According to the party rules in the state of Alabama, to become an elector, a person needed to pledge to support "the nominees of the National Convention of the Democratic Party for President and Vice-President of the United States." That's why, when Edmund Blair, who was qualified to be an elector, refused to take the pledge, Ray told him to go home — which Blair also refused.
Instead, Blair and Ray ended up in the Supreme Court, arguing that Ray was threatening Blair's 12th Amendment right, which "gives electors therein provided for the right to be free to vote for a president and vice-president of the United States without compulsion on the part of any organization or authority." However, the Supreme Court ruled that the state Democratic Party could force a person desiring to be an elector to take that pledge. Justice Stanley Forman Reed delivered the opinion of the court, effectively stating that it was permissible for states to refuse electors based on whether they'll keep their promise to support the candidate who is nominated at the convention.
Even so, the manner of punishing faithless electors was left to the states. However, thus far, a lot of states don't have any rules for this. And no state has very strict consequences for electors who go rogue, and even ones that do rarely enforce them.
In any event, in the grand scheme of things, there haven't been many faithless electors in history, and never has a faithless elector swayed the final vote. To put it into context for this year, Clinton would need 37 faithless electors to bring it to a tie.