Then the presidential race begins. This is done by another system known as the 'Electoral College' system, where each state again has an E.C., delegates of which are essentially kind of elected according to whichever candidate they say they'll vote for.
Whichever candiate receives a majority of all the Electoral College delegates in each state, then 'wins' the state. Whoever wins the most states wins the presidency.
The confusion in 2000 was over the fact that both sides had an equal number of states, and the Florida result was extremely close and so they had some trouble calling it (as there are usually spoilt ballots and other negligible things which in any other circumstance aren't a problem, so it was a bit of a grey area).
The Supreme Court declared a recount unconstitutional for some reason and it came out that Bush won in Florida (Gore won more popular votes nationwide)