How Does an Eraser Remove Pencil Marks?
A pencil leaves a mark by depositing microscopic flakes of graphite between the fibers of the paper. Graphite consists of carbon atoms arranged in thin layers that slide away from one another easily.
The particles remain attached to the paper through weak attractive forces. When an eraser rubs across the mark, friction loosens the graphite and warms the eraser slightly.
The soft material in the eraser attracts the graphite more strongly than the paper does. Graphite particles transfer from the page into the eraser. Small pieces of the eraser then roll together and break away as the familiar crumbs, carrying the graphite with them.
Many modern erasers are made from synthetic rubber or soft plastic. Abrasive particles may be added to help lift graphite, although too much pressure can remove or damage the paper fibers as well.
Ink behaves differently because it is usually absorbed into the paper or chemically bonded to its surface. An abrasive ink eraser works by scraping away part of the paper rather than simply collecting loose material.
Before rubber erasers became common, people used soft pieces of bread to lift graphite from paper.
Source: How Do Erasers Work? McGill University - The Chemistry Behind Erasers, University of California Los Angeles

Early morning on whaling coast, Bahia
Source: Jonathan Wilkins