Wild, trainer, gym and player battles
The four kinds of battle, what each allows, what each pays, and what each one costs you.
In short
- Wild: catch, run, use items. Pays experience, a little money and the materials wild Pokemon drop.
- Trainer: one fight each, no running, items allowed. Pays half again the experience and the trainer's purse.
- Gym: a fixed format in a level window, a few attempts a day, no rematch after a win.
- Player: no items, no running, no reward at all, and the damage stays.
What carries over
Every kind of battle writes back to your Pokemon. HP, status conditions and used PP leave the battle as they were when it ended. Winning a player battle with a poisoned Pokemon on 3 HP means walking to a Pokemon Centre with a poisoned Pokemon on 3 HP. Stat stages, volatiles, Megas and Teras do not carry over.
Wild
Hunt on a route and the encounter starts a wild battle. You may attack, switch, use any item in the Bag including Poké Balls, or run. Running uses the games' escape formula, your Speed against theirs, better with each attempt; a Ghost type always gets away.

A win pays experience to the Pokemon that fought and half to the rest of the party, money of ten times the defeated Pokemon's level, and sometimes a crafting material. Only wild Pokemon drop materials. Catching is covered in the Collecting guides.
Trainer
Route trainers stand in the places they live and fight once. Tap Challenge and the battle starts. No running: leaving is a forfeit. Items are allowed. The opponent's moves are chosen by an AI that estimates damage with the real calculator, so it picks the move that hurts rather than a random one.

A win pays experience at one and a half times the wild rate, the trainer's reward money, and a record of the defeat that quests can read. A beaten trainer says "Beaten" and does not fight again.
Gym
Eight gyms, taken in order, each with its own fixed format: three to six Pokemon, picked from your party and PC, from a window five levels below the leader's level up to it. The leader refuses until the town's League quest is done. An attempt is spent when the battle starts, win or lose, and resets on a rolling day. A win pays the badge, the leader's purse and a reward, and there are no rematches; losing costs nothing but the attempt.

The ladder is in What to do next.
Player
Challenge anyone standing in the same place who is online and not busy. Both sides bring the team they have; nothing is scaled. There are no items, no running and no catching.

Each turn has a 45-second clock. When it runs out nothing happens by itself. The player who is waiting chooses: wait another 45 seconds, as often as they like; call it a tie; or claim the win. Whoever still owes an action, including a replacement after a faint, cannot be the one to claim. Forfeit is always available to either player.
Who sees what
In a player battle you see the opponent's active Pokemon, how many Pokemon it has in total and how many are still standing, and whatever the battle log has revealed: moves it has used, an item or ability that announced itself. You do not see the rest of its party or its IVs. The server keeps the hidden half hidden; the client is never sent it.