Type IV pili (T4P) are prevalent, polymeric surface structures in pathogenic bacteria, making them ideal targets for effective vaccines. However, bacteria have evolved efficient strategies to evade type IV pili-directed antibody responses. Neisseria meningitidis are prototypical type IV pili-expressing Gram-negative bacteria responsible for life threatening sepsis and meningitis. This species has evolved several genetic strategies to modify the surface of its type IV pili based on recombination, phase variation and the presence of different alleles of genes involved in posttranslational modifications. This results in changes in pilin subunit amino acid sequence, nature of glycosylation and phosphoform modification, but how these different processes affect antibody binding at the structural level is still unknown. To explore this question, we provide cryo-electron microscopy structures of pili of different sequence types with sufficiently high resolution to visualize posttranslational modifications. We then generated nanobodies directed against type IV pili which alter pilus function in vitro and vivo; and determined their structures complexed with their pilus target. We also determined how the different types of pili surface modifications alter nanobody binding. These different structures shed light on the impressive complementarity between the different strategies used by bacteria to avoid antibody binding. Importantly, we also show that structural information can be used to make informed modifications in nanobodies as countermeasures to these immune evasion mechanisms.