This space is usually politics-free. Today I take a diversion from that course to make an argument about a political background from a technical perspective.
One of the best principles of software development is the idea of defensive code. That we build code (and systems) that expect certain inputs, validate those inputs, process those inputs, and return the expected results. When we get inputs that don't fit with the expections, our systems have to fail gracefully, limit the damage to other systems, and land in a stable state.
In many ways, a straight democratic process could work. It's not hard to collect votes nationally, to provide some form of real-time reporting, and announce results in realtime. The problem with this is the sheer number of vulnerable points. It means that anyone can inject bad data into the system anywhere – Chicago, perhaps? – and cause changes in the system as a whole… aka changing the overall election results.
In steps the Electoral College…
According to Wikipedia, a traditional firewall is a:
A fire wall is a wall separating buildings or subdividing a building to prevent the spread of fire and having a fire resistance rating and structural stability.
[snip]
Portions of structures that are subdivided by fire walls are permitted to be considered separate buildings, in that fire walls have sufficient structural stability to maintain the integrity of the wall in the event of the collapse of the building construction on either side of the wall.
The Electoral College serves as this firewall separating the corruption (collapse) of one state from threatening the integrity of the system as a whole.
To continue the example from above, in a straight democratic system, flaws with Chicago's voting system could swing the entire system. With the Electoral College in place, those flaws can usually only swing the local elections. Even inserting 10 million votes in Chicago – when national turnout in 2004 was approximately 110 million – has very little affect in the overall system.
It is still possible that in a close election – like those of 2000 and 2004 – that a single state may be the deciding factor, but this is difficult to predict with any great accuracy.