12th Amendment:
The Electors shall meet in their respective states, and vote by ballot for President and Vice-President, one of whom, at least, shall not be an inhabitant of the same state with themselves; they shall name in their ballots the person voted for as President, and in distinct ballots the person voted for as Vice-President, and they shall make distinct lists of all persons voted for as President, and of all persons voted for as Vice-President and of the number of votes for each, which lists they shall sign and certify, and transmit sealed to the seat of the government of the United States, directed to the President of the Senate;
It sounds like the state has no role in this: the electors vote by ballot, the electors tabulate the ballots into a list of president and vice-president and the number of votes for each, the electors sign the tabulation of lists, seal it and the electors transmit it to Congress.
Furthermore, from the 12th amendment:
...they shall make distinct lists of all persons voted for as President...
If the state had the power to mandate that the electors vote for the state's popular vote winner, then why does the 12th amendment allow for the possibility of multiple people being voted for as President by the electors?
-PJ
All of this happens per state law. State laws are why the Electors take a pledge.
See Maine, Nebraska. Vote split between 2 candidates.
2016: Texas, Hawaii, Washington, Maine all had multiple candidates receive votes and Congress accepted them.