One of the primary reasons the colonies revolted against the British monarchy was the lack of representation they had in the government. As a result, when the founding fathers were creating the framework for the new nation they made sure that all citizens were given just and due representation in the government and had a say in electing the leader of the nation.
However, what they failed to do was give the citizens that did not reside in a state a say.
In the early days of the nation this was more common since there were often a number of territories working towards being admitted as a state. Eventually when they were admitted into the union, they were given representation. There was still a small population of the country that was effectively left out--those in the District of Columbia.
When the nation was formed, the framers decided rather than have the nation's capital in a southern or northern state that is should reside in the middle. Maryland and Virginia donated land to what would be designated a federal district and called Washington D.C. as of its creation in 1791. Virginia was later given back the part they donated in 1846 (through a process called retrocession).
People in the District of Columbia were not given a say in the election of the president until the 23^rd Amendment was ratified on March 29, 1961. The Constitution had allotted for a process of selecting electors for the states, which the District of Columbia was not.
After it was ratified they were constitutionally mandated to receive the same number of electors than the least populous state (which was Wyoming (in 2010) who was allotted three electors). This number would be regardless of the population of the District.
Since 1964, the first election in which the District had electors, all of Washington, D.C.'s has gone to the Democratic candidate.