Gym

Gyms are scattered around the world much like PokeStops, but far less frequently. Trainers can use them to train their pokemon and to advance the prestige of their team.

Observing a gym on the world map will tell you a lot about it.
 * Grey Gyms are unclaimed
 * Blue Gyms are claimed by Team Mystic
 * Red Gyms are claimed by Team Valor
 * Yellow Gyms are claimed by Team Instinct
 * Pokemon appearing above the gym are currently set to guard it
 * Lightning and rubble flashing above the gym indicates a battle is under way

Unclaimed gyms can be claimed simply by approaching it and assigning one of your pokemon to it. Any pokemon you assign to a gym will stay with that gym and be inaccessible to you until it is defeated by an unfriendly team member.

Individual trainers can only leave one pokemon to defend per gym, but gyms can be upgraded (or leveled up) to accommodate more and more pokemon from other trainers of the same team.

Gym Levels
Gyms gain EXP through battles. Trainers visiting a friendly gym can train their pokemon, and the gym will gain experience at the same time. Each time a gym reaches a new LVL, another pokemon is allowed to join the gyms defense.

Trainers visiting an enemy gym can battle the defending pokemon and bring the gyms LVL down is successful. Each successful battle will lower the gyms LVL by one, forcing it to remove one of it's defending pokemon. Defeating a LVL 1 gym will remove the last enemy pokemon, leaving the gym open to be claimed fresh.

Trainers with at least one pokemon defending a gym are eligible for the Defenders Bonus.