A pilus (Latin; plural : pili) is a hairlike structure on the surface of a cell, especially gram-negative bacteria. It is an extension of the cytoplasm and used for attachment to surfaces (and is then called fimbrium) and conjugation with another cell of the same species.
Pili, sometimes called sex pili, are used for bacterial conjugation. They connect the bacterium to another of its species and build a bridge between the cytoplasm of either cell. That enables the transfer of plasmids between the bacteria. An exchanged plasmid can add new functions to a bacterium, e.g., an antibiotic resistance.
A fimbrium (latin; plural : fimbriae) is a short pilus that is used to attach the cell to a surface. Fimbriae are either located at the poles of a cell, or are evenly spread over its entire surface. Mutant bacteria that lack fimbriae cannot adhere to their usual target surfaces and, thus, cannot cause diseases.