The Philadelphia Republican Party began posting complaints on Twitter about voter fraud in the city shortly after 6 a.m., saying Republican poll watchers had been barred from polling sites — the complaint was picked up by the conservative website The Daily Caller, gained steam on Reddit and proliferated across Twitter and Facebook.

Separate reports that electronic voting machines in Pennsylvania were switching votes meant for Mr. Trump to Hillary Clinton reached Infowars — a site, long focused on conspiracies, that has recently gained prominence as a pro-Trump outlet — only to be further fueled by a viral video, described as from a Pennsylvania voter, showing difficulty voting for Trump on a touch-screen machine. Soon, The Drudge Report posted a link on Facebook to an article on a conservative website featuring the video with the (uppercase) caption: “Voters report seeing Trump votes switch to Clinton before their eyes …”

By the time a Nevada judge denied a request from Mr. Trump’s campaign to have votes impounded on the ground that poll workers had illegally extended early-voting hours, and Mr. Trump himself suggested in radio and television interviews on Tuesday that he might not accept the result of the election, the floodgates had been opened.

Mr. Trump has frequently expressed doubt about the integrity of the voting process, at campaign events as well as on the night of the 2012 presidential election. “This election is a total sham and a travesty,” he said on Twitter after President Obama’s re-election. “We are not a democracy!”

So it should come as no surprise that Mr. Trump’s most reliably supportive voices on the internet were ready to back up that narrative. Project Veritas, which films undercover videos and orchestrates political stunts, and then shares them through social media and other websites, released a video purporting to show a woman wearing a head scarf and claiming the ballot of Mrs. Clinton’s aide Huma Abedin in New York City. In another video, James O’Keefe, the founder of Project Veritas, was in a car trailing what he called “a pastor’s bus” that was transporting people to the polls in Philadelphia. Mr. O’Keefe promised evidence of people doing “improper things, busing people around.”

By early evening, before the polls had closed, the same alternative media ecosystem that had fostered a sense of confidence and calm in the morning had made allowances for either outcome. “Only Correct Public Brexit Poll Predicts Trump Victory,” said the top headline on Breitbart, all in capital letters. However, right next to an image of Mr. Trump in a smaller typeface (though still all in capitals) was a hedge, courtesy of a series of updating headlines. “Reports of Voter Fraud Hit Social Media,” one stated. Another provided a hint of what might be in store for the night to come, and the days after: “TROUBLE AT POLLS.”