Revives and max revives are used when your Pokemon have been defeated and fainted when battling at a rival gym. They are needed to allow you to use them again.
A revive will restore half of a fainted Pokemon’s maximum HPp.
A max revive will restore full HP
Note that Pokemon will not faint when training at a friendly gym to raise its prestige.
Where to get revives?
You will find revives at Pokestops from level 5 and will also be awarded them when levelling up.