The president is elected by the electoral college. The people elect the representatives in the electoral college. The electoral college does not have to vote for the candidate "elected by popular vote". If McCain wins by popular vote in Kansas, but the Obama wins the most representatives from Kansas in the electoral college, then Obama won Kansas. However, because the vote for electoral college occurs every year, most of the representatives votes will reflect the vote of the people because they want to stay in office. The number of representatives in the electoral college is directly proportional to the number of senators and representatives in the house.
So 100 members in the senate, 435 in the house = 535. However, the electoral has 538 votes, 3 come from the District of Columbia. In the case of a tie, the House of Representatives would vote for the president, where both of the presidential candidates and VP candidates would be in the contest for the ticket. It can be argued, that in the case of a tie Joe Biden has a good chance of being president, as he, supposedly, has many friends in the house.
edit: I looked up the information to double check, and it seems like rules have changed. In the case of a tie, what I previously mentioned would happen, however, 48/50 states have created a winner-takes-all rule, which states that whichever candidate takes the most votes out of any other wins all the votes from the representatives of that state in the electoral college. So the only way a tie would exist is if there is such a division of states that would create equal number of votes for both candidates, which I'm not sure is possible.