You specify which fan and the speed using parameters. So, if I want fan 2 on full, you would do:
M106 P2 S255 ; Turn on fan 2 to speed 255 (full)
The S parameter (speed) goes for 0 to 255. The value 255 is fully on. I think if you leave the S parameter off when running the g-code, you get full on (255).
Turning fans off is similar:
M107 P2 ; Turn off fan 2