Next to the pokéstops you run into walking around the town, there are gyms too. A gym basically a base with pokémon in it from other trainers. When a trainer becomes level 5 it can join a team. There are three teams: Valor (red), Instinct (yellow) and Mystic (blue).
If your team owns a gym, you can donate one Pokémon to help defend it. You can’t power up or evolve the Pokémon as long as it is in there. Whenever the Pokémon you put inside dies, it will be transferred back to you with 1HP remaining. If your Pokémon has the highest CP you will be the gym leader. Every gym has a certain amount of Prestige Points (PP). Unclaimed gyms (Level 1) have a max of 2000 PP. Level 2 gyms will have one Pokémon guarding it have a max PP of 4000 and so on. The amount of PP is shown at the top left.
Having a Pokémon in a gym gives you certain bonuses. Every 20-21 Hours you will receive Stardust and Coins. Each cycle you will get 10 Coins and 500 Stardust. You can be part of multiple gyms at the same time, so the bonuses can add up really nicely. The maximum amount you can receive with 10 Pokémon in different gyms is 5000 Stardust and 100 Coins per day.
If you find a gym that’s being held by the same team you are in, you can raise the prestige level of that gym. You can do this by donating one of your Pokémon or by participating in friendly battles. Whenever you are able to donate a Pokémon the Prestige Points will automatically rise and the level will increase as well. It’s not always possible to simply add another Pokémon, in those cases, you can battle a friendly gym to increase the maximum Prestige level. If you win the battle, the gym will gain Prestige Points and you will earn XP. You can only use one Pokémon in friendly battles. Once it gains another level, you can put your own Pokémon inside and benefit from the bonuses. Your Pokémon won’t faint in a friendly battle, but you will have to restore their HP with potions. Potions are the only way to heal a Pokémon, it won’t heal over time.
If you are fighting an enemy gym, you can take 6 Pokémon instead of one! If you lose a battle, this time, your Pokémon will faint. You can revive a fainted Pokémon with the item Revive. If you win the battle the Prestige Points will lower and causes the gym to decrease in level. Whenever you beat all the Pokémon the lowest level Pokémon will be kicked out. You will have to repeat this process until there are no Pokémon left and then it is yours. You will automatically be the new gym leader since you are the only one with a Pokémon in the gym.
The best strategy to defend a gym is by putting Pokémon of different types in them, so if it already has a Fire Pokémon, be sure to put a Grass Pokémon in it for example. Holding a gym with only one Pokémon will be exceptionally hard because the attacker is allowed to take 6 Pokémon just to beat it. So if you want to hold a gym make sure you help out your teammates and get that gym to the highest level possible!
Be sure to check out the article on IV’s to get the strongest Pokémon possible to help you in battle!