To understand the invention of the Electoral College, we have to look at the circumstances under which it was created. The founding fathers faced the unique difficulty of how to elect a president in a newly formed nation. Where they'd come from, there were only kings, so they had no practical experience; they had to wing it. The country at the time was made up of 13 states of varying sizes. Each of them had their own laws and powers. Everybody had just come through a scary revolution and still had a phobia about powerful, centralized governments.
The country consisted of a mere 4,000,000 citizens spread over hundreds of miles of Atlantic coastline, with no transportation but ships and horses, and none of the modern communication technology that we enjoy today. Keep in mind also that many citizens were slaves, and many more were women.
The Constitution Convention met together and hashed this out. They debated several methods of electing a president. Eventually, the members settled on an indirect election of the President through the College of Electors. Remember that they only knew monarchy where they came from? So they got the idea from the Catholic Church; it, too, selects a new Pope using a College of Cardinals! In a hierarchical system in which the most informed and knowledgeable individuals would guide the process, the College would select the President based on merit alone, and not on what state he was from or what political party he was in.
So it got set down in Article II, Section 1 of the Constitution. Each state would get a set amount of Electors. Kind of like the rules for doling out armies in the board game Risk, it didn't matter how the rules for dispensing Electors was set up, so long as it was fair enough. So they decided that allotted Electors would be based on the number of Representatives in each state, plus two for each state's Senators. Since provisions were left in place to ensure that each state could create more districts and appoint more Representatives as their populations grew, and since how Electors were to be chosen would be left up to each state, they figured everybody would be happy with that.
Normally, by the morning after the election, the final results are in, and the entire country knows who the next president and vice president will be. But whether we have a normal election or a contested one, the outcome still has to be made official. In December, the members of the Electoral College travel to their state capitals to cast their official electoral votes, sign some necessary documents... When congress convenes in January, senators and representatives gather for a joint congressional session, and the official results are announced from all the states. At noon on January 20 following a presidential election, the term of the preceding president ends and that of the incoming president begins. At a formal inauguration ceremony, the chief justice of the U.S. Supreme Court swears in the president and the vice president before members of Congress, government dignitaries, representatives of foreign governments, and important well-wishers, as well as a national television audience. After an inaugural address and parade, the new president is on the job.