Chips are mounted on the wafer thru a process called photolithography. Under this process, chemicals sensitive to ultraviolet light are used. When exposed to ultraviolet light, they can become “soft” or “hard”. So basically this process consists in blocking the ultraviolet light from the chemicals applied to the wafer using stencils (the masks created by the engineers), removing the “soft” parts, and then repeating the process again with another mask, until the chip is finished.
click to enlarge Figure 2: How photolithography works.
Of course each mask has a different pattern and they tell how the transistors and wires inside the chip will be manufactured. The numbers of masks used vary depending on the project. A Pentium 4 processor, for example, uses 26 masks.