Consider the movement like your wrist. It moves back and forth and rotates. This addes the two additional axis.
I have a training tape from Thermwood on 5 axis programming that I need to watch....looks interesting. I bet the figuring of the best tool path is a processing bear!