Trump goes into the convention with somewhat less than the 1237 needed. The further from that figure Trump is then the better it is for Cruz.
The first ballot is taken, nobody has a majority. At this point delegates are no longer bound to the candidate they voted for.
In the second round the Trump delegates that were recruited from Cruz supporters change their votes to Cruz. Cruz argues that Trump has peaked and momentum is shifting his way. That only his vote totals are going up.
On the third ballot he hopes to convert Rubio and, perhaps, Kasich voters to his side. In any case his vote total has to continue to increase for his argument to make any sense.
Fourth ballot or later Cruz is able to win.
Wildly optimistic? Perhaps. But at this point it's the only chance Cruz has.
Cruz loses 40% of his delegates on the 2nd ballot.
The numbers say that in subsequent rounds his numbers get worse. Not better.
I don’t think it even takes a third ballot. All the stuff Trump didn’t want to do, all the ground work and forming relationships with the local people who become delegates pays off for Cruz.
Once they aren’t bound to Trump, Trump loses.