Change your preferences here.
For 5 turns, slower Pokémon move before faster ones, thus reversing the normal turn order. However, the turn Trick Room is used counts as a turn and thus the effects will be usable only for the next four turns. However, the user of Trick Room will not always go first, as until it is used, normal circumstances apply. This does not affect priority—higher priority moves will still be used before lower priority ones. Pokémon with Full Incense, Lagging Tail, Quick Claw, or Stall completely ignore Trick Room. Using Trick Room when Trick Room is already in effect will remove Trick Room.
Smogon has an article on this topic.