An eraser, called a rubber in some places, is an item used to remove the marks left by pencils and some types of pens.
A pencil mark consists of graphite particles that have peeled off from the pencil point onto the paper. Erasers pick up graphite particles, thus removing them from the surface of the paper. Basically, the molecules in erasers are 'stickier' than the paper, so when the eraser is rubbed onto the pencil mark, the graphite sticks to the eraser preferentially over the paper. A single rub using an eraser sufficiently soft to reach between the fibers will pick up most of the graphite particles. Looking at the eraser you can see undamaged graphite pieces sticking to the surface.