“Nobody can do a good job on their own,” said Mel Stankewitcz, 69, a plumber who said he had voted for Mr. Ryan. “I don’t think anyone in Washington is doing what they’re supposed to be doing. They just yell at each other.”

Mr. Ryan’s surprise announcement comes in a year of wild and unpredictable political races in Wisconsin, and instantly sent the election in the state’s First Congressional District into turmoil. Republicans set off on a furious scramble for a candidate to replace Mr. Ryan on the ticket in a district that could conceivably swing to Democrats.

At least two Democrats have already said they will try to win in Mr. Ryan’s district: Randy Bryce, a mustachioed ironworker who is known by his Twitter handle, “Iron Stache,” and Cathy Myers, a schoolteacher. And even before Mr. Ryan’s departure from consideration, Republicans were contending with a potential spectacle on their own side of the ticket: Paul Nehlen, a white nationalist and anti-Semite who lost to Mr. Ryan in a 2016 Republican primary, has said he is running, though state Republican officials say they have no place for him in the party.

In Janesville, few of Mr. Ryan’s constituents — neither his supporters nor his detractors — said they could disagree with his choice not to run again. In this hilly city with a proud past as an automotive manufacturing stronghold, residents said they easily remembered when Mr. Ryan first ran for Congress two decades ago, back when he cut a youthful, idealistic figure who seemed to represent the Republican Party’s promise.

“People thought he was going to be the president,” said Leo Salto, 41, a cook.

Though Mr. Ryan spends most of his time in Washington, he remains a familiar face in Janesville, constituents said. With his wife, Janna, he attends St. John Vianney, a Catholic church. Sometimes he is spotted running errands at Ace Hardware. The owner of the Citrus Cafe, a restaurant a short walk from the Ryans’ house, said the congressman comes by the restaurant with his family, ordering the “eggceptional skillets” on the menu.