It depends on the number in the class and the number in the group.
If your class has 22 students, and there are 11 in each group, there are 352,716 ways to choose sides. If your class has 21 students, and there are 7 in a group, there are 66,512,160 ways to choose teams. (I may have lost count around 50 million somewhere. LOL)
I believe the number you seek is the product of
- the number of combinations
of (remaining class size) taken (group size) at a time, where (remaining class size) is the size of the class before the current group is chosen.
That product then needs to be divided by the number of permutations of (class size)/(group size) things taken that many at a time.
If we let C = the number of students in the class, and G = the number of students in the group, the number of ways of forming teams (T) according to the above calculation method reduces to
T(G,C) = C!/(((G!)^(C/G))*(C/G)!)
Some "representative" numbers:
T(10,5) = 126
T(10,2) = 945
T(22,11) = 352,716
T(21,7) = 66,512,160
T(21,3) = 36,212,176,000