Actually the vote outcome doesn't matter. The state government selects its electors, usually based on the vote. However, once they select their electors and the electors vote its a done deal. (Except in the case of a tie and he house votes)
I don't think the state government selects electors. I believe each party selects electors for its candidate; those whose candidate got most votes in the state get to cast their votes in the electoral college. So, you will find that electors are quite partisan. It's a privilege to be selected by your state party to be a presidential elector.