It's automatic. If some of your defending troops survive an attack some of the dead go to the hospital and are revived. You have no control of how many or which.
If I'm correct lets say that you have:
Spears: 200
Swords: 100
Archers: 100
Someone attacks you and kills all your units (they must be defending your village). If you have max level hospital then if you go to hospital you should get half of those troops back (depending on max beds available)
Spears: 100
Swords: 50
Archers: 50
It will be interesting to find out if these also works while supporting a player as well.
The hospital counts provisions so if you, for example, have 300 beds available only 75 light cavalry units can be healed because each counts as 4 provisions.
Edit: And the hospital will always heal half of your dead units. For example 20 spear fighters die while defending, your hospital will heal 10 as long as there are free beds available.
Actually It isn't. Cause I had it completely full, I clicked every image, and clicked on where it said 300/300 and then I clicked on the one that was a count down time. I clicked on everything that was possible in there and nothing happened.
There should be a green tik next to units healed. Click that and they are ready to use. I just went and checked this out in Alnwick as i hadn't realised you had to do this till i read the post.......