After the mass shooting in August in Dayton, Ohio, Mr. Ryan spoke forcefully in favor of gun control, telling CNN that Mitch McConnell, the Senate majority leader, needed to “get off his ass and do something.” With the advocacy group Moms Demand Action, he led a “caravan” from Ohio to Louisville, Ky., where Mr. McConnell lives.

Guns were one of a handful of issues — abortion was another — on which Mr. Ryan notably evolved during his House tenure. He once had an “A” rating from the National Rifle Association, but donated the money he had received from its political action committee to gun control groups after the Las Vegas shooting in 2017.

But his central message was always about the economy.

Mr. Ryan described the decline of traditional manufacturing not only as the focus of his campaign, but also as its impetus. He often recounted his daughter calling him in tears after a friend’s father lost his job at General Motors and saying, “You have to do something.”

So, he liked to say, he did something: He ran for president.