Mr. Giuliani was a temple-throbbing Italian-American New Yorker who ruled a cacophonous city seen as the very definition of liberalism. He was somewhat liberal on social issues  notably immigration and abortion  where Republican candidates are invariably conservative. And he possessed a complicated family life: he has been thrice-married and has two adult children who rarely speak to him. At the beginning of his campaign last spring, he sat for a celebrity photo shoot smooching with his third wife, who snuggled in his lap.

“It bordered on science fiction to think that someone as liberal on as many issues as Rudy Giuliani could become the Republican nominee,” said Nelson Warfield, a Republican consultant who has been a longtime critic of the former mayor. “Rudy didn’t even care enough about conservatives to lie to us. The problem wasn’t the calendar; it was the candidate.”

Several of Mr. Giuliani’s campaign aides acknowledged as much Tuesday. They say he tried to tack right without ever really convincing voters that he had experienced a change of heart. And an adviser who has known Mr. Giuliani since the early 1990s and spoke on condition of anonymity said the mayor’s early poll numbers struck him as ephemeral.

“His numbers were built on name recognition and celebrity,” this adviser said. “He had so many of his old friends around him, sometimes it was like he was running for president of Staten Island.”

In his concession speech Mr. Giuliani acknowledged, jokingly, how out of place he often seemed among conservative Republicans. “We’re a big party and we’re getting bigger,” he said. “I’m even in this party.”

After his third-place finish, Republican officials said Mr. Giuliani was expected to drop out of the race and endorse Mr. McCain, possibly as early as Wednesday.

In the beginning, few cracks were evident in the Giuliani campaign machine. He led the Republican field in polls conducted by The New York Times and CBS News throughout the summer, as his support peaked in August at 38 percent nationally in a four-way fight with Mr. McCain, Mr. Romney and Fred D. Thompson. That put him 20 points ahead of his next closest competitor, Mr. Thompson, who has since dropped out of the race.