After 1st round, I believe all delegates become unbound meaning they can vote for anybody.
Rules vary from state to state as to how and when their delegates are released.
Example of GA rules:
Georgia Code § 21-2-196: “... a delegate or ... shall file a qualification oath ... pledging support ... to the candidate ... for the office of President ... for whom they are selected to support. The oath shall state that the delegate ... affirms to support such candidate until the candidate is either nominated ... or receives less than 35 percent of the votes for nomination ..., or until the candidate releases the delegates.... No delegate shall be required to vote for such candidate after two convention nominating ballots...”
Georgia Code § 21-2-197: “Any delegate to a national convention whose presidential candidate withdraws ... shall be an unpledged delegate ...”
http://www.thegreenpapers.com/P12/GA-R#0306
While delegates may be technically free to vote for anyone after the first ballot, you have to factor in their affinity for the candidate they are representing.
In most states (I think) the delegates are elected BECAUSE they represent that they are FOR candidate “X”. Most of them have a lot of time, money and love invested in that candidate because they want him for President.
So although they may be free after the first ballot, most will continue to vote for their candidate until it becomes hopeless and/or they are ‘released’. The trick for the candidate is to maintain his control over his delegates and not let them bleed away as it becomes apparent that he cannot make a deal to win.
When a candidate decides to quit and releases his delegates it usually comes with a very strong suggestion that they vote for candidate “y” with whom candidate “x” has made a deal for either a spot on the ticket as V-Pres. or at the very least something desirable like Sec. of State or whatever. It all depends on how many delegates he can control and how badly ‘Y’ wants them.
Conventions that are not a fait accompli are fun and exciting.