Type IV pili (T4P) are multifunctional protein fibers produced on the surfaces of a wide variety of bacteria and archaea. The major subunit of T4P is the type IV pilin, and structurally related proteins are found as components of the type II secretion (T2S) system, where they are called pseudopilins; of DNA uptake/competence systems in both Gram-negative and Gram-positive species; and of flagella, pili, and sugar-binding systems in the archaea. This broad distribution of a single protein family implies both a common evolutionary origin and a highly adaptable functional plan. The type IV pilin is a remarkably versatile architectural module that has been adopted widely for a variety of functions, including motility, attachment to chemically diverse surfaces, electrical conductance, acquisition of DNA, and secretion of a broad range of structurally distinct protein substrates. In this review, we consider recent advances in this research area, from structural revelations to insights into diversity, posttranslational modifications, regulation, and function.