It's a good idea to begin with a clean eraser. To clean excess graphite from a white plastic or gum eraser, simply rub it briskly on a piece of coarse scrap paper. Card - the rough brown kind - cut from breakfast cereal boxes works well. If your eraser is very greasy and dirty, you can use a craft knife to trim away the ends.
To clean a kneadable eraser, you need to stretch and fold the eraser like putty, so that a fresh surface is created. After a while, the eraser becomes saturated and you will need to replace it.