It appeared the decision by some Republicans to distance themselves from Mr. Trump did not harm them, and perhaps even saved them in some districts. Ms. Comstock, who represents the nation’s wealthiest district, said little about Mr. Trump until the recording became public, becoming one of the first in her party to disavow him because of it. She won a close race after Democrats hammered her for what they said were her policy similarities to Mr. Trump, a strategy employed against other endangered Republicans. Hillary Clinton won her district.

Carlos Curbelo, a freshman representative of Florida, who had been outspoken against Mr. Trump throughout his race, held his seat in a re-election battle that pitted him against Joe Garcia, whom he defeated two years ago. Democrats spent more than $2 million to try to reclaim the hotly contested district. Mr. Trump won his district.

Perhaps more than the strength of their candidates or platform, Republicans have gerrymandering to thank once more for their renewed House majority. After the 2010 census, responsibility for congressional redistricting fell largely to Republican-controlled state legislatures, which clumped voters in districts that would help more from the party get elected.

What remains is a House remarkably insulated from national electoral swings — a contrast with the founding fathers’ image of a chamber more susceptible to the will of the people, said Michael Li, an expert on redistricting and senior counsel for the Brennan Center for Justice’s Democracy Program.

There were concerns that anything but a Trump victory could present new obstacles for Speaker Paul D. Ryan. During the campaign, many conservative members who backed Mr. Trump expressed frustration with Mr. Ryan, the highest-ranking Republican elected official, for declining to defend Mr. Trump after the release of that 2005 recording.

That frustration has metastasized into mutinous murmurings about blocking Mr. Ryan’s re-election as speaker. Before Election Day, at least a handful of Republicans had declined to say if they will back him in internal leadership elections, scheduled to be held when Congress returns early next week.