Is there a rule like "the lower the speed the better quality?"
I tried taking at different speeds but couldn't understand the difference.
Shutter speed affects image quality in two principal ways. Firstly the longer the shutter is open (the slower the speed) the more light you get. The more light you get the less noise you have as it evens out the random emission of photons from a lightsource, and raises the signal produced by the sensor above the noise floor (the camera electronics produce a background level of noise, the bigger the signal you generate, by having more photons hit each pixel in the sensor, the less this background noise is noticed). This assumes you alter the other settings (aperture, ISO) to maintain the same exposure (overall brightness) in the image.
There is a point however when a long exposure can make an image noisier as it allows heat to build up on the sensor, which affects the recorded image.
Secondly shutter speed controls the impression of motion in an image. A long exposure/shutter speed blurs motion, giving the impression of greater motion of the camera or subject. It can enhance the image by making athletes or cars look like they're going very fast. It can detract from the image if the subject is not intended to be moving (e.g. a portrait) or if camera motion causes the image to come out blurred.
The shutter speed is used to stop action or create the impression of movement. If you're shooting motorsports, field sports etc you will find yourself wanting a short shutter speed to capture the action in a nice sharp picture.
The longer the shutter is open the more a subject can move, creating blur in your picture. The quicker the shutter the less chance there is of a subject moving so there's more chance of capturing a sharp image where motion has been stopped.
A long shutter can be used to create the feeling or capture movement in a picture. Waterfalls, fireworks, dancing, sports etc can all be shot with slower shutter speeds to produce images that show movement.
Fast shutter speeds are often required when dealing with long focal lengths to minimise the effect of camera shake. There's a rule to use a shutter speed of 1 over the focal length of the lens you're using (for 35mm cameras). So if you're shooting at 300mm then have a shutter speed of 1/300th (of course if you're on a 1.5x corp sensor then your effective focal length is 450mm, so you'll need 1/450th of a second.
Zack Arias said it really well in his OneLight DVD:
Shutter speed controls ambient exposure... Aperture controls flash exposure.
It's important to understand what this means, primarily when introducing strobe lights (flashes) into the photography, and how to balance light sources.
Sensors & film activate when exposed to a volume of light. That volume could be intense over short period of time or mild over a long period of time. (Think about a burst from a firehose or a slow leak from a garden hose; both will fill up a bucket; one just takes longer than the other.)
Shutter speed lets you control the time aspect of the exposure equation. Aperture lets you control the intensity. (ISO is similar to aperture in this respect, though really it's more akin to controlling the size of the bucket.)
Continuous (think: the Sun, light bulbs) and (think: "leftover" light from continuous sources) are effectively "on" for the entire time you'd want to spend making the photo. With these sources, you can trade off shutter speed and aperture and get pretty much the same exposure. (You'll get other effects too, like motion blur and depth of field, but that's another topic.)
A flash/strobe, however, is an extremely intense, extremely short-lived burst of light. (Potentially brighter than the Sun in fact.) The duration is often less than 1/1000 of a second. It's so fast that it will have dumped all its light into the scene well within the time you allow the shutter to remain open. (There's a lower limit on shutter speed that you can use with a flash called the "sync speed"; this is caused by limitations in the camera, not the speed of the flash's light.)
Effectively, you can't control the amount of light coming from a flash via the shutter speed. You must do it in other ways. Aperture is the most common, though flash power and flash distance to subject work too. (Each has their own consequences.)
This is why "shutter controls ambient; aperture controls flash." To get a correct exposure from your flash-lit subject, you need to set the aperture correctly for the amount of light coming off your flash; shutter speed won't help. Once that's set, you can play with your shutter speed to control the amount of ambient light that leaks into the background. Crank up a faster shutter speed, and the background goes black; the sensor doesn't have enough time to register the ambient light. Slow down the shutter, and the ambient becomes more and more significant: you get a brighter and more detailed background.