Your analysis assumes that they only have Trump and Clinton to pick from.
What about Pence, Ryan, Kasich, McCain, etc...
I could see 26 Republican states agreeing to give it to on of them.
Not only would the Republican delegations come into play but think about a state like Illinois. There are 10 Dem districts and 8 Rep districts. Knowing that at the end of the day, a Republican is going to win, I bet Illinois could be convinced to cast their vote for someone like Kasich or Ryan to avoid someone like Trump or Cruz.
The 12th Amendment only allows the House of Representatives to choose from “the persons having the highest numbers not exceeding three on the list of those voted for as President.”
That is the basis for the McMullin campaign in Utah. If he could win one state, he would be the third potential candidate if the House of Representatives where to choose the President.
Everyone always talks about this procedure “if there is a tie,” because no third party candidate has won any electoral votes since George Wallace in 1968. Richard Nixon had more than 270 electoral votes, so it did not go to the House that year.