National
Electoral votes are allocated among the States based on the Census. Every State is allocated a number of votes equal to the number of Senators and Representatives in its U.S. Congressional delegation—two votes for its Senators in the U.S. Senate plus a number of votes equal to the number of its Congressional districts.
Under the 23rd Amendment of the Constitution, the District of Columbia is allocated three electors and treated like a State for purposes of the Electoral College.
Each State (which includes the District of Columbia for the Electoral College) decides how to appoint its electors; however, they must do so according to law enacted before Election Day. Currently all States use the popular vote results from the November general election to decide which political party chooses the individuals who are appointed.