The ability of populations to adapt depends on a complex suite of traits including mutation and recombination rates and functional constraints on genes subject to selection. How much selection can act on these traits to promote adaptability remains an open question. This dissertation investigates the ultimate example of evolved adaptability, the adaptive immune system of jawed vertebrates. Adaptive immunity has been selected in jawed vertebrates to recognize pathogens through recombination, mutation and selection in populations of B cells rapidly evolving during the immune response within an individual. This short- term adaptability is enabled by the diversity of immunoglobulin genes that recombine to produce B cell receptors and by the receptors’ mutation rate during the immune response, features that have been shaped by selection in vertebrate populations over hundreds of millions of years. We explore how these features contribute to the adaptability of the immune response through computational and statistical analyses of the response to influenza and HIV. We ask if despite possible epistatic interactions among recombining immunoglobulin genes, specificity for particular pathogens is associated with individual genes. We find that influenza infection in mice selects for B cell receptors using specific immunoglobulin genes during the immune response, suggesting that selection of immunoglobulin genes in the long term could lead to their specialization for particular pathogens. Because the adaptability of B cells depends on mutations that change affinity for the antigen, we also investigate the short-term evolution of mutational hotspots in B cell receptor sequences. While the long-term evolution of immunoglobulin genes led to an abundance of hotspots in the antingen-binding loops of the receptor, we find that selection and neutral mutations disrupt those hotspots over years of coevolution between B cells and HIV, a loss of mutability that might limit the adaptability of B cell responses to chronic or repeated infections. Finally, we investigate how immunity arises from infection history and how the resulting protection shapes the ecology of influenza virus lineages. We conclude by proposing ways to integrate life-history and ecology into the study of the adaptability and specialization of immunity.