Democrats were unable to persuade enough electors to withhold their support for Mr. Trump. He easily cleared the 270-vote threshold needed to defeat Hillary Clinton, with only two Republican electors declining to cast their vote for the president-elect. But the protests at state capitols across the country offered a preview of a tumultuous inauguration and first 100 days of the new administration.

Presidential electors are bound by tradition and often state law to support their party’s candidates. But this time, many Republican electors were inundated with phone calls, emails and even threats demanding that they vote for someone other than Mr. Trump. Leaders of groups that were lobbying the electors had privately believed they had a chance to sway enough Republican electors to defect, denying him an Electoral College majority and throwing the election to the House of Representatives.

But while Mr. Trump’s opponents needed 37 Republican defectors to bring his electoral-vote tally below 270, the bulk of electors who broke ranks — four in Washington State — were Democrats who otherwise would have voted for Mrs. Clinton. Instead, three voted for former Secretary of State Colin L. Powell, a Republican, and one for Faith Spotted Eagle, a Native American tribal leader who has led opposition to the Keystone XL pipeline.

Kellyanne Conway, Mr. Trump’s campaign manager, said the election “wasn’t a squeaker.”

“The professional political left is attempting to foment a permanent opposition that is corrosive to our constitutional democracy and ignores what just happened in this election,” she said. Liberals cannot, she added, “wave magic pixie dust and make this go away.”