The federal government makes no laws about who the electoral members need to vote for, but many states have their own laws about such things.
For example, in Colorado (my home state), all the electoral members must vote for the candidate who got the majority of the votes within that state. It's law.
In Maryland, the electoral college must vote in the same ratio that the voters of that state did - for example, if 60% of the vote is for one candidate, 2 of the 3 electoral votes will go for that candidate. That's how the state has determined it will go.
I think the thing that is getting confused here is that you seem to think that the electoral candidates just cast whatever vote they please. This does not happen - in fact, it has never happened. Even if it's not law in all states, it's custom which goes deeper than law. If a member of the electoral college did this, he would probably be lynched.
So, yes, while there is the slight possibility that an electoral vote which is contrary to the will of the people might be cast, it has never, ever happened so your point is invalid anyway.
:: I am the speaker at the dawn of the age
:: and I stand at the door to the west.
~X~