I have never seen either of these classes offered at an actual trial, so my understanding is based purely on what's written in the AKC rulebook and I'll defer to anyone who has actually seen the optional classes in action.
With that caveat in mind:
-- Both Pairs and Teams can be offered at any level (Novice, Advanced, or Excellent).
-- Pairs is basically a brace competition: one handler running two dogs simultaneously.
-- Teams is like a relay race: four teams, each consisting of one dog and one handler, who run the course consecutively. The time clock keeps going continuously until all four teams have finished the course. Each team's scores are added together to make a final score (so the maximum possible score would be 400 if all four teams earned perfect 100s).
That said, again, I've never seen a club actually offering either of these classes at a competition. I know there's a team event at the All-Star event, but that's an exhibition show, not an official trial.
My local GSD club offers pairs in rally. It can be beyond hilarious. One Aussie (a UD)decided she did NOT want to work with her partner (and housemate), and refused to do most of the exercises. Another pair (an Ibizan and an Grande Podengo) managed to switch sides about halfway through the course.
Each dog has their own score sheet, and scores are added together.