you should usually take one while you're transferring your wort to the primary, just to find out what your original gravity is to calculate ABV and figure out how close you are to hitting your desired numbers.
You'll also take one when your fermentation is done, or you'll find out it isn't quite done yet. If you're doing extract and your reading is 1.016 or below, you could be real close to done, wait another couple days and check again. Make sure to sanitize everything that touches your beer in the fermenter. A turkey baster usually works really well to get the beer out. Sanitize that, set your airlock/stopper combo in a bowl of sanitizing solution when you're taking the sample, and make sure to sanitize the area around the airlock on the fermenter as well. Hope that all helps!