dnd 5th – When does a character get all his hit dice?

To my knowledge, there is no effect to reliably recover all Hit Dices spent at one time. The main way to recover the dice is to take a long rest, but you can only recover half of your total dice per long rest.

At the end of a long rest, a character recovers all the points of life lost. The character also gets the dice hit, up to a number of dice equal to half the total number of characters. You recover at least 1 Hit Die when you finish a long rest.

Rest, Player's Manual, p. 186

So, if a character has spent all his dice and wants to get all his dice back, he will have to spend two dice (or maybe three, if his DM rounds the dice for an odd level) Long Rests to fully recover all his dice. of their hit dice. All is cumulative, so if you spent less than half of your dice, one Long Rest will get all your dice back.