A gym can store one Pokemon per gym level, and only one Pokemon per player. If you already have a Pokemon parked at a particular gym, you cannot put another one there.
You can raise your gym level by raising its Prestige, at 2000 prestige per gym level. This is done by training at the gym, pitching one of your Pokemon against the gym's roster. The more Pokemon you defeat, the more Prestige that is awarded.
For example, my 337 Golem was taking down my local gym's 3 Pokemon at 433 Prestige per run. I did this from 6000 to 8000 Prestige so that I could park my Pokemon in the newly available slot.
Consequently, attackers follow the opposite pattern. With a roster of six Pokemon, they will attempt to defeat the Pokemon at the gym. Doing so reduces the Prestige. Once the Prestige is low enough to de-level the gym, the lowest-CP Pokemon is kicked out. This is done until the gym hits 0 Prestige, from which it goes uncontrolled. Then anyone near the uncontrolled gym can claim it.
There is currently no way to restore a Pokemon's health aside from items. Potions are your friend.