Donald Trump will be the GOP’s presidential nominee. Within the party, talk of a brokered Republican National Convention or even a supporting a third-party candidate has circulated among those hoping to stop him from becoming the next president, leaving Trump antagonists across the spectrum to ponder whether there’s any fail-safe left, after November, to stop a Trump administration from becoming a reality. There is. The electoral college. If they choose, state legislators can appoint presidential electors themselves this November, rather than leaving the matter of apportioning electoral college votes by popular vote. Then, via their chosen electors, legislatures could elect any presidential candidate they prefer. Remember, Americans don’t directly elect the president. The electoral college does: Slates of electors pledged to support presidential and vice presidential candidates are voted upon in each state every four years. Each state, and the District of Columbia, is apportioned at least three of the 538 electors, allocated by the total number of U.S. senators and House members each state has. In December, these electors will gather in their respective states and cast votes for president and vice president. And in January, Congress counts these votes, determines if a candidate has achieved a majority — at least 270 votes — and then certifies a winner.
We take it for granted that the individual votes we cast will be the ones that select the slate of presidential electors in our state. But the Constitution makes no such guarantee. In fact, it says the states appoint electors “in such Manner as the Legislature thereof may direct.”
Some of the Founders worried that rash decision-making by the collective body politic would be “radically vicious” or “liable to deceptions” if they directly elected the president, for the people would lack the “capacity to judge” candidates. While members of the House of Representatives would be accountable directly to the people, presidential elections would occur indirectly. Electors, not the people, would elect the president. And state legislatures could decide how. (Most states now have laws binding electors to vote for the candidate who wins their state’s popular vote — but many states don’t.)
In the earliest presidential elections, many states did not have popular elections for electors. Their legislatures simply chose electors. Over time, states gradually moved toward the popular elections we now take for granted.
https://www.washingtonpost.com/posteverything/wp/2016/03/17/if-no-one-else-stops-trump-the-electoral-college-still-can-its-in-the-constitution/