Why do some periodic tables have 18 groups while others have 8?
Unfortunately, life sometimes is more complicated than school :)

Using 8 groups works well to teach the basic principle, but higher shells have space for more electrons. (And lower shells for fewer - ever wondered why there are only two elements in the first period?)

Hence, you'll get 18 electrons in the next shell (the "transition metals"), then 32 electrons ("Lanthanides/Actinides") - the general rule is $2n^2$, where $n$ is the number of the period. This is unfortunately made even more complex, as the energies of the shells are not quite what one would expect and they are not filled "in order." One probably should stop speaking of "shells" at this point and move towards "orbitals."

Anyway, the community has pretty much settled on using 18 groups nowadays. The idea behind the periodic system is to find regularities (hence the name) between elements.

It turns out, that individual groups and trends within them are similar in the 8 "main" groups (as you have learned). In the transition metals, there are still a fair few regularities, that justify this arrangement - but they are already a lot more similar to each other than say alkali-metals and halides. The Lantanides/Actinides finally are so similar to one another, that they are "grouped" (although they in fact are part of a period) together - they in fact so similar, that they usually only occur in mixtures in nature, and separating them is quite hard. 

Finally: no heavier atoms have been discovered so far that would have to go into an even bigger "shell"/orbital. Hence, one could justify up to 32 groups, but for practical reasons, 18 are conventionally used.