As an example, if the majority of voters in Florida vote for the Republican candidate for president, then all 29 of the electoral votes will go to the Republican electors. Electors are pledged to vote for the presidential and vice presidential candidate for whom they were chosen. While some states have passed laws that require their electors to vote with the popular vote, there are a number that have no such stipulation. They are free to choose whoever they want or even refrain from voting entirely. However, this rarely happens. When they do go against their chosen candidate, they are called 'faithless electors'. The last example of a faithless elector was in 2004 when the elector seemingly accidentally cast their vote for Johnathan Ewards instead of Johnathan Edwards. Before this, an elector for Washington, D.C. pledged to vote for Al Gore and Joe Lieberman, did not vote at all in protest for D.C.'s lack of representation in Congress.
The method by which electors is determined by each state's legislators. Some states use a primary system to pick electors while others allow the party conventions to choose. According to Article II, Section 1, Clause 2 of the US Constitution, electors are not allowed to be either an elected or appointed federal official.
Learn more about the electoral college: