Depends on the game and circumstances.
Without the modern Exp. Share, there wasn't much of a choice. It was a pain for boxed Pokémon or Pokémon caught at low levels in the late game to catch up. The grinding wasn't worth the trouble, so basically just get a decent team and stick with it, no need to swap except for HM duties. In some cases, I would also use a couple early game Pokémon temporarily if most of the Pokémon I wanted for my team appeared late.
In the modern games, I typically end up using around 10-12 Pokémon, and swap them around because of level caps. Made an exception for the Indigo Disk DLC in the latest games, since it focusses entirely on double battles I picked three additional Pokémon to play around this format. I don't really like training and using too many Pokémon.
And I'm not a fan of building teams to counter specific trainers either. Some heavy difficulty rom hacks are designed around this concept but I prefer sticking to one team as much as possible and don't change unless it's really necessary. If my current team can legitimately achieve victory I don't care if there are other Fire types that could have done a much better job than my current Fire type in one particular battle or section of the game. I believe part of the fun in playing Pokémon is that you can't have the best counter for everything, so you have to work with what you have.