Article II, Section 1, Clause 2:
Each State shall appoint, in such Manner as the Legislature thereof may direct, a Number of Electors, equal to the whole Number of Senators and Representatives to which the State may be entitled in the Congress: but no Senator or Representative, or Person holding an Office of Trust or Profit under the United States, shall be appointed an Elector.
The electoral college was one of the compromises by which the delegates were able to agree on the document finally produced.
This subject, said James Wilson, referring to the issue of the manner in which the President was to be selected,
has greatly divided the House, and will also divide people out of doors. It is in truth the most difficult of all on which we have had to decide.1 Adoption of the electoral college plan came late in the Convention, which had previously adopted on four occasions provisions for election of the executive by the Congress and had twice defeated proposals for election by the people directly.2 Itself the product of compromise, the electoral college probably did not work as any member of the Convention could have foreseen, because the development of political parties and nomination of presidential candidates through them and designation of electors by the parties soon reduced the concept of the elector as an independent force to the vanishing point in practice if not in theory.3 But the college remains despite numerous efforts to adopt another method, a relic perhaps but still a significant one. Clause 3 has, of course, been superseded by the Twelfth Amendment.