This article is from the Macintosh hardware FAQ, by Elliotte Rusty Harold email@example.com with numerous contributions by others.
Poor mouse tracking is normally a sign of dirty contacts. To clean
them get a cassette tape head cleaning solution from any audio store.
Turn off the Mac. Then unplug the mouse. The bottom plate of the
mouse that holds the ball in place can be removed by pushing down and
twisting (like a child-proof medicine cap). The ball will probably
fall out when the plate is removed so be ready to catch it. There's
nothing quite so annoying as having to crawl around on the floor
looking under the furniture for a mouse ball. Dip a cotton swab in
the solution. Then rub it on the three ball contacts until they
appear clean to the eye. Finally clean the ball itself with soap
and water and dry it with a paper towel. At this point it wouldn't
hurt to replace your mouse pad to. A grungy mouse pad will make
even a clean mouse ball dirty in no time. I often use a heavy
bond paper taped to my desk rather than a mouse pad because it's so
easy and cheap to replace.