The 'Learning' and 'Reference' sections of this site are great for learning the basics. Have a look there and if you still have questions then let us know.
How do you have the fan connected to the Arduino ? I assume that you are not using the Arduino pin to drive the fan motor...