That, he added, “is so important to me.”

He offered unusually warm words for Mrs. Clinton, who he has suggested should be in jail, saying she was owed “a major debt of gratitude for her service to our country.”

Bolstered by Mr. Trump’s strong showing, Republicans retained control of the Senate. Only one Republican-controlled seat, in Illinois, fell to Democrats early in the evening. And Senator Richard Burr of North Carolina, a Republican, easily won re-election in a race that had been among the country’s most competitive. A handful of other Republican incumbents facing difficult races were running better than expected.

Mr. Trump’s win — stretching across the battleground states of Florida, North Carolina, Ohio and Pennsylvania — seemed likely to set off financial jitters and immediate unease among international allies, many of which were startled when Mr. Trump in his campaign cast doubt on the necessity of America’s military commitments abroad and its allegiance to international economic partnerships.

From the moment he entered the campaign, with a shocking set of claims that Mexican immigrants were rapists and criminals, Mr. Trump was widely underestimated as a candidate, first by his opponents for the Republican nomination and later by Mrs. Clinton, his Democratic rival. His rise was largely missed by polling organizations and data analysts. And an air of improbability trailed his campaign, to the detriment of those who dismissed his angry message, his improvisational style and his appeal to disillusioned voters.