Charles Evans Hughes supposedly had this experience in 1916. He was leading until late returns from California gave Wilson the win.
Samuel Tilden
He ran for president in 1904 and won, and again in 1912, but lost.
Richard Nixon
George Bush 41 lost his bid for a second term to Bill Clinton.
abrham lincoln
Yes, most recently was Al Gore who lost his home state of Tennessee in 2000.
Hilary Clinton tried for the Democratic nomination in 2008. She came close to winning but lost out at the end.
The republican candidate for president of the United States in 2012 was Mitt Romney, former governor of Massachusetts. He lost the General Election to Barack Obama.
Thomas Dewey of New York was the losing Republican candidate in 1948 against Truman.
Senator Ted Kennedy challenged President Carter for the Democratic nomination in the 1980 primaries. Despite a spirited campaign, Kennedy ultimately lost to Carter, who went on to be the Democratic candidate in the general election, where he lost to Republican candidate Ronald Reagan.
Woodrow Wilson probably had serious doubts in 1916. The Republican candidate , Charles Evans Hughes, was heavily favored by those who predict elections and the election was tipped by late returns from California. Wilson likely thought he would lose when he went to bed on election night.
The Whig Party had lost much of its power by 1856, and at their national convention in September of that year they chose not to put up a candidate of their own for president but rather to endorse the American Party's candidate, Millard Fillmore.