The annual dinner features a lighthearted speech from the president; that year, President Obama chose Mr. Trump, then flirting with his own presidential bid, as a punch line. He lampooned Mr. Trump’s gaudy taste in décor. He ridiculed his fixation on false rumors that the president had been born in Kenya. He belittled his reality show, “The Celebrity Apprentice.” Mr. Trump at first offered a drawn smile, then a game wave of the hand. But as the president’s mocking of him continued and people at other tables craned their necks to gauge his reaction, Mr. Trump hunched forward with a frozen grimace. After the dinner ended, Mr. Trump quickly left, appearing bruised. He was “incredibly gracious and engaged on the way in,” recalled Marcus Brauchli, then the executive editor of The Washington Post, but departed “with maximum efficiency.” 

That evening of public abasement, rather than sending Mr. Trump away, accelerated his ferocious efforts to gain stature within the political world. And it captured the degree to which Mr. Trump’s campaign is driven by a deep yearning sometimes obscured by his bluster and bragging: a desire to be taken seriously. That desire has played out over the last several years within a Republican Party that placated and indulged him, and accepted his money and support, seemingly not grasping how fervently determined he was to become a major force in American politics. In the process, the party bestowed upon Mr. Trump the kind of legitimacy that he craved, which has helped him pursue a credible bid for the presidency. 


“Everybody has a little regret there, and everybody read it wrong,” said David Keene, a former chairman of the  American Conservative Union, an activist group Mr. Trump cultivated. Of Mr. Trump’s rise, Mr. Keene said, “It’s almost comical, except it’s liable to end up with him as the nominee.” Repeatedly underestimated as a court jester or silly showman, Mr. Trump muscled his way into the Republican elite by force of will. He badgered a skittish Mitt Romney into accepting his endorsement on national television, and became a celebrity fixture at conservative gatherings. He abandoned his tightfisted inclinations and cut five- and six-figure checks in a bid for clout as a political donor. He courted conservative media leaders as deftly as he had the New York tabloids. 


At every stage, members of the Republican establishment wagered that they could go along with Mr. Trump just enough to keep him quiet or make him go away. But what party leaders viewed as generous ceremonial gestures or ego stroking of Mr. Trump — speaking spots at gatherings, meetings with prospective candidates and appearances alongside Republican heavyweights — he used to elevate his position and, eventually, to establish himself as a formidable figure for 2016. In an interview on Friday, Mr. Trump acknowledged that he had encountered many who doubted or dismissed him as a political force before now. “I realized that unless I actually ran, I wouldn’t be taken seriously,” he said. But he denied having been troubled by Mr. Obama’s derision. “I loved that dinner,” Mr. Trump said, adding, “I can handle criticism. 

Even before the correspondents’ dinner, Mr. Trump had moved to grab a bigger role in political affairs. In February, he addressed the annual Conservative Political Action Conference. Organizers gave Mr. Trump an afternoon speaking slot, and Mr. Keene perceived him as an entertaining attraction, secondary to headliners like Mitch Daniels, then the governor of Indiana. But Mr. Trump understood his role differently. Reading carefully from a prepared text, he tested the themes that would one day frame his presidential campaign: American economic decline, and the weakness and cluelessness of politicians in Washington. 

Over the next few months, Mr. Trump met quietly with Republican pollsters who tested a political message and gauged his image across the country, according to people briefed on his efforts, some of whom would speak about them only on the condition of anonymity. One pollster, Kellyanne Conway, took a survey that showed Mr. Trump’s negative ratings were sky-high, but advised him there was still an opening for him to run. Another, John McLaughlin, who had been recommended to Mr. Trump by the former Clinton adviser Dick Morris, drew up a memo that described how Mr. Trump could run as a counterpoint to Mr. Obama in 2012, and outshine Mr. Romney with his relentless antagonism of the president. 


Roger Stone, a longtime Trump adviser, wrote a column on his website envisioning a Trump candidacy steamrolling to the nomination, powered by wall-to-wall media attention. After all that preparation, Mr. Trump rejected two efforts to “draft” him set up by close advisers. If his interest in politics was growing, he was not yet prepared to abandon his career as a reality television host: In mid-May, Mr. Trump announced that he would not run and canceled a planned speech to a major Republican fund-raising dinner in Iowa. 


Having stepped back from a campaign of his own, Mr. Trump sought relevance through Mr. Romney’s. Again, Mr. Trump’s determination to seize a role for himself collided with the skepticism of those he approached: While he saw himself as an important spokesman on economic issues and a credible champion for the party, the Romney campaign viewed him as an unpredictable attention-seeker with no real political foundation. Still, given his expansive media platform — in addition to his reality-show franchise, Mr. Trump was a frequent guest on Fox News — and a fortune that he could theoretically bestow upon a campaign, Mr. Trump was drawing presidential candidates seeking his support to his Fifth Avenue high-rise. In September 2011, Mr. Romney made the trip, entering and exiting discreetly, with no cameras on hand to capture the event. 


The decision to court Mr. Trump, former Romney aides said in interviews, stemmed partly from the desire to use him for fund-raising help, but also from the conviction that it would be more dangerous to shun such an expert provocateur than to build a relationship with him and try to contain him. The test of that strategy came in January 2012, before the make-or-break Florida primary, when Mr. Trump reached out to say he wanted to endorse Mr. Romney at a Trump property in the state. Wary of such a spectacle in a crucial state, Mr. Romney’s aides began a concerted effort to relegate Mr. Trump’s endorsement to a sideshow. 


The Romney campaign conducted polling in four states that showed Mr. Trump unpopular everywhere but Nevada, and suggested to Mr. Trump that they hold an endorsement event there, far away from Florida voters. On the day he was to deliver the endorsement in Las Vegas, according to Mr. Romney’s advisers, Mr. Trump met with Romney aides and said he hoped to hold a joint news conference with Mr. Romney, raising for the campaign the terrifying possibility that Mr. Romney might end up on camera responding to reporters’ questions next to a man who had spent months questioning whether the president was an American citizen. 


In an appeal to Mr. Trump’s vanity, the Romney campaign stressed that his endorsement was so vital — with such potential to ripple in the media — that it would be a mistake to dilute the impact with a question-and-answer session. “The self-professed genius was just stupid enough to buy our ruse,” said Ryan Williams, a former spokesman for the Romney campaign. While they agreed to hold the event in a Trump hotel, the campaign put up blue curtains around the ballroom when the endorsement took place, so that Mr. Romney did not appear to be standing “in a burlesque house or one of Saddam’s palaces,” Mr. Williams said. On stage, as the cameras captured the moment, Mr. Romney seemed almost bewildered. “There are some things that you just can’t imagine happening in your life,” he told reporters as he took the podium, taking in his surroundings. “This is one of them.” 


Mr. Trump insisted in the interview that the Romney campaign had strenuously lobbied for his support, and described his own endorsement as the biggest of that year. “What they’re saying is not true,” he said. But if Mr. Trump expected a major role in the Romney campaign, he was mistaken. While Mr. Trump hosted fund-raising events for Mr. Romney, the two men never hit the campaign trail together. The campaign allowed Mr. Trump to record automated phone calls for Mr. Romney, but drew the line at his demand for a prominent speaking slot at the Republican National Convention. (Mr. Trump recorded a video to be played on the first day of the convention, but the whole day’s events were canceled because of bad weather.) 


Stuart Stevens, a senior strategist for Mr. Romney, believed that Mr. Trump had been strictly corralled. “He wanted to campaign with Mitt,” Mr. Stevens wrote in an email. “Nope. Killed. Wanted to speak at the convention. Nope. Killed.” Still, to Mr. Romney’s opponent that year, the accommodation of Mr. Trump looked egregious. Mr. Obama, in a speech on Friday, said Republicans had long treated Mr. Trump’s provocations as “a hoot” — just as long as they were directed at the president. 


Only a handful of people close to Mr. Trump understood the depth of his interest in the presidency, and the earnestness with which he eyed the 2016 campaign. Mr. Trump had struck up a friendship in 2009 with David N. Bossie, the president of the conservative group Citizens United, who met Mr. Trump through the casino magnate Steve Wynn. Mr. Trump conferred with Mr. Bossie during the 2012 election and, as 2016 approached, sought his advice on setting up a campaign structure. Mr. Bossie made recommendations for staff members to hire, and Mr. Trump embraced them. Mr. Trump also carefully cultivated relationships with conservative media outlets, reaching out to talk radio personalities and right-wing websites like Breitbart.com. 


By then, Mr. Trump had won a degree of acceptance as a Republican donor. Advised by Mr. Stone, one of his longest-serving counselors, he had abandoned his long-held practice of giving modest sums to both parties, and opened his checkbook for Republicans with unprecedented enthusiasm. Mr. Trump began a relationship with Reince Priebus, the Republican National Committee chairman, who was trying to rescue the party from debt. He gave substantial donations to "Super PACS" supporting Republican leaders on Capitol Hill. In 2014, he cut a quarter-million dollar check to the Republican Governors Association, in response to a personal entreaty from the group’s chairman — Chris Christie. Still, Mr. Trump’s intentions seemed opaque. 


In January 2015, Mr. Trump met for breakfast in Des Moines with Newt and Callista Gingrich. Having traveled to Iowa to speak at a conservative event, Mr. Trump peppered Mr. Gingrich with questions about the experience of running for president, asking about how a campaign is set up, what it is like to run and what it would cost. Mr. Gingrich said he had seen Mr. Trump until then as “a guy who is getting publicity, playing a game with the birther stuff and enjoying the limelight.” In Iowa, a different reality dawned. “That’s the first time I thought, you know, he is really thinking about running,” Mr. Gingrich said. 


On June 16, 2015, after theatrically descending on the escalator at Trump Tower, Mr. Trump announced his candidacy for president, hitting the precise themes he had laid out in the Conservative Political Action Conference speech five years earlier. “We are going to make our country great again,” Mr. Trump declared. “I will be the greatest jobs president that God ever created.” Still, rival campaigns and many in the news media did not regard him seriously, predicting that he would quickly withdraw from the race and return to his reality show. Pundits seemed unaware of the spade work he had done throughout that spring, taking a half dozen trips to early voting states of Iowa, New Hampshire and South Carolina and using forums hosted by Mr. Bossie’s group to road test a potential campaign. 


Even as he jumped to an early lead, opponents suggested that he was riding his celebrity name recognition and would quickly fade. It was only late in the fall, when Mr. Trump sustained a position of dominance in the race — delivering a familiar, nationalist message about immigration controls and trade protectionism — that his Republican rivals began to treat him as a mortal threat. Mr. Trump, by then, had gained the kind of status he had long been denied, and seemed more and more gleeful as he took in the significance of what he had achieved. “A lot of people have laughed at me over the years,” he said in a speech days before the New Hampshire primary. “Now, they’re not laughing so much.”