In phage display, a library of phages is created, each displaying a different peptide or protein variant. These phages are exposed to a target molecule, such as a toxin or antibody. Phages that bind to the target are then separated and amplified through bacterial infection, allowing researchers to identify the sequences of peptides or proteins that have a strong affinity for the target. This iterative process is known as biopanning.