These four men and a woman who weren't really president, but were really close.
1. John Hanson // 1781-1782
You may not know that America was not originally a constitutional democracy, but a confederation (which meant the states were sovereign entities) from 1776 until the Constitution was ratified in 1789. And while the individual states were free to run things however they chose within their own borders, they still decided that there would be a national one-house ruling body (with very limited power) called the Congress of the Confederation.
During the eight years that the Congress existed, eight men (one each year) held the title of President of the Continental Congress, essentially the highest seat in the land. It wasn’t anywhere near the same thing as the current Presidential office, as is frequently alleged (it was far less powerful and had far different duties), but it was the closest thing they had to such an office. Thus, the first official “president” of the United States was John Hanson, a delegate from Maryland (who was not black, as a modern urban legend alleges).
Further Presidents of the Continental Congress from 1782 onward were Elias Boudinot, Thomas Mifflin, Richard Henry Lee, John Hancock (yes, that John Hancock), Nathaniel Gorham, Arthur St. Clair, and Cyrus Griffin.
2. David Rice Atchison // 1849-1849
David Rice Atchison was only ever officially one kind of president: President pro tempore of the U.S. Senate. But, for one day in 1849, he may have been something more. Zachary Taylor, taking the reins from President James Polk, was to be inaugurated on March 4, 1849. Taylor, however, refused to be inaugurated on a Sunday and asked to delay until Monday, the 5th. Millard Fillmore, his vice president, was also not able to be inaugurated that day.
Thus, under the rules of succession at that time (which were not the same as the ones we have today), David Rice Atchison would have been president for that single day, though no one took that particularly seriously. Atchison was known to make jokes about it from time to time.
Or maybe something even weirder happened: Officially, Atchison's job as President pro tempore had actually expired when the final session of Congress under Polk was adjourned (although Atchison was once again nominated to the position when Congress resumed). So it’s also very possible that, technically speaking, no one at all was president for that one day in March-- the first and only time since 1789.
3. Benjamin Franklin Wade // 1868-1868
After Abraham Lincoln's assassination, Andrew Johnson stepped into the role of president, which meant it was up to him to decide how to handle Reconstruction. Johnson opted to take the moderate approach that Lincoln had started, providing amnesty for southern states so as not to deepen the already-existing wounds between the north and the south.
This raised the ire of a group known as the "Radical Republicans," who wanted ex-Confederate states to be punished and freed slaves to be given more protections under law. So, when Johnson made moves to remove Radical Republican and Secretary of War Edwin M. Stanton from office, the Radical Republicans in Congress passed a law preventing the president from removing a cabinet member from office without senate approval. When Johnson did it anyway (replacing Stanton with Lorenzo Thomas), the Radical Republicans seized on it and impeached Johnson.
During Johnson’s trial, some legal scholars argued that he should be removed from duty until the trial was completed. Since Johnson had no vice president, this would have made Benjamin Franklin Wade—a Radical Republican, one of the judges of Johnson's trial, and President pro tempore of the Senate—the acting president, though Johnson was never officially relieved of his duty, so it ended up being merely legal speculation.
In fact, had Johnson been found guilty, Wade would have instantly become president. Some writers at the time actually suggested that the strong dislike that fellow politicians and other powerful people had for Wade was one of the many reasons that Johnson was eventually acquitted.
4. Edith Wilson // 1919-1921
In 1919, during Woodrow Wilson’s second term, he came down with a severe case of the flu which, combined with his existing hypertension and unwillingness to rest and recover, eventually led to him having a massive stroke in October of that year. It left him paralyzed and blind on the left side of his body, heavily incapacitating him.
Yet, instead of resigning, his wife and doctors started a cover-up of his condition that went on for over a year. President Wilson was never to be in the same room with his cabinet members, vice president, or any visitors. Instead, Edith, his wife, acted as his steward, bringing important items directly to him and assigning the rest to various department heads and other cabinet members. Although President Wilson was back to making occasional appearances and remarks within a few months, his health status was still closely guarded.
While Edith claimed that her husband made the final decision on all the matters she brought to his attention, many presidential scholars have since asserted that this was likely not true and that Edith probably consulted the president little due to his poor health. So, it seems quite likely that, for about a year and a half, Edith Wilson was, essentially, the unofficial President of the United States.
5. Dick Cheney // 2002-2002, 2007-2007
In 1967, Congress passed the 25th amendment to the United States Constitution, which finally set down specific, official presidential succession laws in the event that the president is not dead, but unable to perform his duty. (Woodrow Wilson's case was specifically mentioned.)
Since that time, this power has only been used by two presidents, and only one of the two vice presidents never went on to be elected to the office himself: Dick Cheney. (The other was George H. W. Bush, who was briefly made acting president under Ronald Reagan.)
On June 29, 2002, President George W. Bush underwent a regularly scheduled colonoscopy and had to be anaesthetized for the procedure. So, from 7:09 am to 9:24 am EDT, Dick Cheney was officially Acting President of the United States of America. Five years later, on July 21, 2007, during President Bush's five-year checkup, the 25th amendment was again invoked from 7:16 am to 9:21 am EDT.
Since Dick Cheney didn't run for the presidency (and doesn't seem likely to do so), he is, to date, the only man to have ever officially acted as president (for four hours and twenty minutes) without later holding the office himself.