What is the best technique for shaking a can of spray paint?
Whichever way you find easiest.  Seriously it probably doesn't make a whole lot of a difference.  Put a drop of food coloring in a bottle of water. Stir it, shake it, invert it - eventually it will mix.  All of the cans I've bought suggest shaking it for a minimum duration and that is probably meant to ensure it is mixed regardless of method.