Live from the Rumpublicans' Self-Made Gehenna: Faithless Electors: "Twenty-one states do not have laws that compel their electors to vote for a pledged candidate...:
...Twenty-nine states plus the District of Columbia have laws to penalize faithless electors, although these have never been enforced. In lieu of penalizing a faithless elector, some states, like Michigan and Minnesota, specify that the faithless elector's vote is void.
Until 2008, Minnesota's electors cast secret ballots, so that it was not possible to tell if a particular elector was faithless. When in 2004 an unknown elector was faithless, Minnesota law was amended to provide for public balloting of the electors' votes and invalidation of a vote cast for someone other than the candidate to whom the elector is pledged.
The constitutionality of state pledge laws was confirmed by the Supreme Court in 1952 in Ray v. Blair. The court ruled in favor of the state's right to require electors to pledge to vote for the candidate to whom they are pledged, as well as to remove electors who refuse to pledge. Once the elector has voted, his or her vote can be changed only in states such as Michigan and Minnesota, where votes other than those pledged are rendered invalid. In the twenty-nine states that have laws against faithless electors, a faithless elector may only be punished after he or she votes.
The Supreme Court has ruled that, as electors are chosen via state elections, they act as a function of the state, not the federal government. Therefore states have the right to govern electors. The constitutionality of state laws punishing electors for actually casting a faithless vote—rather than merely refusing to pledge—has never been decided by the Supreme Court.