See individual state rules at link.
What happens to delegates allocated to candidates who withdraw?
The Delegate Selection Rules for the 2020 Democratic National Convention include two provisions regarding the binding of delegates to the candidates they supported at the time of their selection.[11]
No delegate at any level of the delegate selection process shall be mandated by law or Party rule to vote contrary to that persons presidential choice as expressed at the time the delegate is elected.[13]
Rule 13.I (p. 14)[11]
Delegates elected to the national convention pledged to a presidential candidate shall in all good conscience reflect the sentiments of those who elected them.[13]
Rule 13.J (p. 14)[11]
Beyond this, the Delegate Selection Rules do not directly address how a candidate's withdrawal from the race before the convention affects the delegates pledged to that candidate. However, in 13 states, statutes establish provisions for the release of delegates either upon a candidate's withdrawal or after a specific number of ballots have been taken at the national convention. The table below identifies these states. In the column titled "Candidate withdrawal or release provision," a "yes" indicates that the statute allows for the release of pledged delegates either upon a candidate's withdrawal or at the explicit direction of the candidate. In the column titled "Multiple ballot provision," a "yes" indicates that the statute allows for the release of a pledged delegate after a specific number of ballots have been taken at the convention (the number in parentheses indicates the ballot on which the delegates would be released). The full text of relevant statutes and their citations are also provided.
https://ballotpedia.org/Democratic_delegate_rules,_2020