There are multiple steps but the basic process is that you use a photoresist.
At the beginning of a process step, a photoresist is "spun" on to the wafer. It is a very literal thing, they spin the wafer while dripping the polymer onto the surface which spreads out into a thin layer of precise thickness. This is cured and then placed into a photolitographic machine, which projects an image onto the wafer that leaves latent images in the Photoresist (AKA PR).
The PR is developed (some resists are negative and some are positive, which means the exposed areas stay or the exposed areas are eliminated). the development process removes the parts of the PR that are to be removed leaving behind the desired pattern.
The PR can define areas that are etched (removed) or windows through which ions are implanted. Implanting is the process through which the Si is doped.
Once the area is implanted, the remaining PR is removed and the wafer is thermally treated to anneal the implant damage.
In between litho steps are depositions, growths, etches, wet baths, plasma treatments etc.