Printer calibration is usually done by printing a set of known colors, scanning them in with a known device, and using compatible software to compare the results of the scans against "known good" values that the scanned print colors should be replicating. Scanning can be done with a spectrophotometer, or with a colorimiter. Spectrophotometers are usually used in high end and commercial devices, while colorimiters are used in most consumer grade devices. Any divergence between the actually printed colors, and the expected colors that should have been printed, are processed into an ICC color profile that is valid for the combination of printer, paper, ink formulation and sometimes lighting conditions. Once a color profile has been created for a particular output configuration, you generally do not need to recreate one. If the printer, ink formulation, paper, or lighting conditions change, only then would you need to generate a new color profile.
There are a few ways to actually calibrate a printer. The cheapest is probably to use an online service. You print out their calibration page on the printer, paper, and inks you wish to calibrate, send it in, and they will produce an ICC profile for you. Such calibrations are usually adequate. If you prefer to manage the process yourself and achieve the maximum amount of color reproduction accuracy, you can buy a variety of calibrators. Some require that you print a color swatch sheet, and scan one swatch at a time. Some allow you to print a color swatch sheet, and scan one strip of swatches at a time. Higher end systems will allow you to print a color swatch sheet, and then scan the whole thing into the calibration software with a feeding scanner. The latter is most useful when you have a lot of papers to calibrate. Usually, a strip scanner is sufficient for home printing. It should be noted that not all printer calibration systems are equal. Some only calibrate color, some calibrate with fewer colors than others. Better systems can calibrate both color and black & white output, and produce an ICC profile that is ideal for both types of prints.