The basic principle of a scanner is to analyze an image and process it in some way. Image and text capture (optical character recognition or OCR) allow you to save information to a file on your computer. You can then alter or enhance the image, print it out or share it on the internet or by e-mail.
Any image from a scanner, or from a digital camera, or in a computer, is a digital image. Computer images have been "digitized", a process which converts the real world color picture to instead be numeric computer data consisting of rows and columns of millions of color samples measured from the original picture.
The color and brightness of each tiny area seen by a sensor is "sampled", meaning the color value of each area is measured and recorded as a numeric value which represents the color there. This process is called digitizing the image. The data is organized into the same rows and columns to retain the location of each actual tiny picture area.
It may help to realize that a picture constructed of colored mosaic tile chips on a wall or floor is a somewhat similar concept, being composed of many tiny tile areas, each represented by a sample of one color. From a reasonable viewing distance, we do not notice the individual small tiles, our brain just sees the overall picture represented by them. The concept of pixels is similar, except that these pixels (digitized color sample values) are extremely small, and are aligned in perfect rows and columns of tiny squares, to compose the rectangular total image. A pixel is the remembered color value of each one of these color samples representing tiny square areas. The size of the image is dimensioned in pixels, X columns wide and Y rows tall.
When all of this image data (millions of numbers representing tiny color sample values, each called a pixel) is recombined and reproduced in correct row and column order on printed paper or a computer screen, our human brain recognizes the original image again. The complex work is done automatically by the computer, and we can overlook most of it. What we do need to know is 1) pixels exist, and 2) digital images are dimensioned in pixels, and 3) how to determine and supply the sufficient dimension in pixels for our usage goal.
The image size in pixels determines what we can do with this image - how it can be used, and if it is appropriate size for the intended use. There are two fundamental uses which cover almost every application: printing the image on paper (print a photo or in a book, etc), or showing the image on a video screen (snapshots or web pages, etc). These two situations are rather different with different concerns. But either way, we must create the image size (dimension in pixels or dpi) to be suitable for the way we will use it. Choosing the proper scanning resolution allows us to create proper image sizes.