All around Mr. Trump were reminders of his ordeal over the last several months. One of the members of the escort committee that brought him in, Representative Hakeem Jeffries of New York, is part of the team of House Democrats prosecuting him. The president encountered Chief Justice John G. Roberts Jr., who is presiding over the Senate trial and seemed intent on maintaining a studious neutral expression during their brief exchange.

While he made no mention of impeachment, Mr. Trump did single out Senator Mitch McConnell of Kentucky, the Republican leader who has single-handedly ensured he would survive the trial without witnesses testifying against him. “Thank you, Mitch,” Mr. Trump said at one point, referring to the senator’s help confirming judges, but it would not be surprising if he were grateful for other reasons.

The president’s grim mood belied what was otherwise a good day for him. Aside from his coming acquittal and the chance to address the largest television audience of the year uninterrupted, Mr. Trump earlier in the day reveled in the Democratic dysfunction in the Iowa caucus and avidly sought to exploit it to promote suspicion among his rivals.

He and his sons and allies pumped out Twitter messages suggesting the botched Iowa count was an effort to rig the election for former Vice President Joseph R. Biden Jr., and against Senator Bernie Sanders, the candidate the president would rather face in the fall.

“It’s a fiasco that just plays right into us,” the president told television network anchors during an off-the-record lunch earlier in the day, according to people in the room.

“What other people would look at as a moment of completely political meltdown for this president, it all appears to accrue to his benefit,” said Matt Schlapp, the chairman of the American Conservative Union. “He actually looks like the adult in the room.”

Democrats acknowledged that the Iowa breakdown played to Mr. Trump’s advantage, at least in the short term.