If no candidate has a majority of electors appointed, the question would be sent to the House which is directed to “immediately” select the president from the persons with the three highest total electoral votes. As in the case of the disputed Tilden-Hayes election of 1876, the instruction to act “immediately” has never been taken literally and is almost surely unenforceable.
The House is directed to vote by state with each state having one vote, a quorum having been established of “a member or members of two thirds of the states.” In today’s House, 26 state delegations are Republican and, when voting by state, it is the state delegations that decide by majority vote how the state’s vote is to be cast. States with Republican majorities would be expected to vote for the Republican candidate on the list. If the next House looks like the current House, Trump likely wins.
Please read more here.