The gymleader code demands rules are laid out before a battle begins and that all parties lucidly agree to them. They're not set in stone per gym (just per battle), but gymleaders tend to have preferences (see Sehto gym circuit).
Rules in pokégyms come in two major forms: Freeform and Turn-based. Turn-based means one person's move is followed by a move from the opponent and vice versa, and is considered more difficult, especially since even accidental multiples constitute a loss, and few people have that fine a control over their pokémon. Freeform means that moves are independant of each other. Most of Sehto's pokégyms use freeform rules.
Beyond that, there are a few things that need to be laid out:
Number of pokémon (active and overall): The number of pokémon that will be used for a fight needs to be determined. There is no standard line-up. Overall pokémon numbers allowed in battle range from 'two' to 'as many as you have'; active pokémon numbers allowed in battle range from 'one' to 'any amount you can handle', including exotic rules like 'as many pokémon as the gymleader is actively using at the time'. Shorthand: Active#/Overall# (e.g. 2/2 - 'two active, two overall'; 1/6 - 'one active, six overall'; ~/~ - 'any amount you can handle, however many you have'; =/~ - 'as many pokémon as the gymleader is actively using at the time, however many you have')
Criteria of loss: A knock-out usually constitutes a loss. There can be additional battle-loss criteria (e.g. the Feather Badge's 'loss by touch of Zubat') or harsher rules (e.g. 'loss only by death' is conceivable). A reasonably common addition to the ruleset is that a pokémon that's switched out is to be considered out of the game, and that the death of an opponent's pokémon disqualifies. Shorthands:
- Standard: Knock-out or death constitutes a loss
- Knock-out-only: Death disqualifies, switch-outs are OK
- Playing-field: Switch-outs are loss
Consequences of loss: In the majority of cases, there are no hard consequences to losing. There can, however, be custom consequences such as 'a re-match is not allowed', or Kzye City's 'pokémon that lost to the pokégym's pokémon belong to the gymleader', or Taqnateh's steep order of 'if you lose, you lose everything'.
Item usage: Non-hold items are usually not allowed in Sehto gym circuit battles. Exceptions may be made on a gym by gym basis.
Move usage: Moves are not usually restricted, but it's conceivable certain moves (cited either individually or by effect) might be disallowed. 'Moves' in Sehto can be moveset or spontaneous (e.g. “leap up to that platform!” is a 'spontaneous' move) and it's conceivable that either of them might be given a blanket ban, e.g. the Feather badge battle could conceivably demand spontaneous moves only, or the Dust badge battle might demand moves be restricted to moveset rules. This doesn't usually happen, though.
Rematches are usually allowed (see 'consequences of loss' for when they aren't), although it's entirely up to the gymleader when they'll field your request for one. Commonly, a day's wait is expected.
Other stuff:
Prize, yay: On a win, pokégyms grant the victor the badge and it's customary to part with a small sum of money to cover a week's worth of the most basic needs, roof over head distinctly not included. It's not a faux pas for the gymleader to wait for it to be requested, though (even if some of them might feel personally uncomfortable if they forget), and is generally not given to people that look like they're doing fine by themselves.
Shelter: Many gymleaders will either provide or grant help finding shelter, however, since Sehto at large views pokétrainers doing the gymcircuit as only a little bit better than bums (and we all know how forthcoming people are giving homeless complete strangers a home).