According to the Constitution electors are free to vote their conscience.
True, to a point...usually, political parties nominate electors at their state conventions. Sometimes that process occurs by a vote of the party’s central committee. The electors are usually state-elected officials, party leaders, or people with a strong affiliation with the Presidential candidates. While the Constitution nor Federal election laws compel electors to vote for their party’s candidate, twenty-seven states have laws on the books that require electors to vote for their party’s candidate if that candidate gets a majority of the state’s popular vote. In 24 states, no such laws apply, but common practice is for electors to vote for their party’s nominee.