Battling at the Gym
** A gym under the control of a different team can be battled. The defending Pokémon in the gym will lose CP if they lose the battle. When their CP reaches 0, they will return to its owner.
** When the gym has no Pokémon left in it, the gym can be taken over. 
** You can choose six Pokémon to take into battle with you.
Adding Your Pokémon into the Gym
** When the gym is under the control of your own team, you can add your Pokémon into it if there is an open position.  Each gym has six slots.
** You earn 1 coin for every 10 minutes your Pokémon defends the Gym.  There is a 50 coin limit per day.  You will earn your coins when your Pokémon is defeated and returns to you.
** You can feed Berries to Pokémon of your team . You will earn 20 Stardust per Berry and a chance to earn a Candy of that Pokémon you fed.
The Gym's PokéStops
** Each gym doubles as a PokéStop.  These PokéStops will give more items if your team controls the gym. 
Raid Battles
** Each gym is capable of holding a Raid Battle.
** Raid Battles have levels.  These levels range from 1-5.  They higher the level, the harder it is to take down the Raid Boss.
**  Level 5 raids feature the Legendary Pokémon and are the hardest to take down.
** Up to 20 trainers can participate in a Raid Battle.  A Raid Pass is required to join the Raid.  One free Raid Pass is given daily and can be obtained at a gym's PokéStop.
** An EX Raid Pass is required to participate in a EX Raid.  Trainers can invite one person from their Ultra or Best Friend list to join them at the raid.  The Gym is closed during an EX Raid and non-pass holders can not enter the gym for the PokéStop.