The story of how Mr. McConnell held Republicans together — even in the face of stunning revelations about the president’s conduct and uneasiness in his party about Mr. Trump’s actions — reflects how a master Senate tactician deployed his command of procedure and keen political instincts to lock down a process that posed an existential threat to the president. In doing so, he may have cemented the president’s hold on his office and provided a defiant campaign message to propel him to re-election, uniting the party around a figure who brooks no dissent and dealing a death blow to Democrats’ hopes of removing him.

“If this was all about politics, and it was, at least at the moment I think it is fair to conclude that we won and they lost,” Mr. McConnell said in an interview on Thursday in his Capitol office, before he headed to the White House, where he was effusively thanked by the president and received a standing ovation in the East Room.

A Year of Preparation

Democrats contend that the victory is hollow, and that they won something as well, showing the public that Senate Republicans — including several who are facing re-election this year in politically competitive states — were unwilling to challenge Mr. Trump on either his behavior or his blithe dismissal of Congress’s right to oversee the executive branch.

“What we feel is we created Pyrrhic victory for them,” Senator Chuck Schumer, Democrat of New York and the minority leader, said in an interview. “This trial is regarded by most Americans as not a real trial, a sham. The acquittal has virtually no value because Americans know it wasn’t fair.”

But it evidently has great value to the president and to Mr. McConnell, who had spent nearly a year preparing for it. From the instant that Democrats assumed power in the House last January, denying that they had any intention of impeaching Mr. Trump, Mr. McConnell, a six-term Kentuckian and the longest-serving Senate Republican leader, directed his staff to quietly dig into the history of impeachments and consult with outside experts.