The most abundantly studied societies, with the exception of humans, are those of the eusocial insects, which include all ants. Eusocial insect societies are typically composed of many dozens to millions of individuals, referred to as nestmates, which require some form of communication to maintain colony cohesion and coordinate the activities within them. Nestmate recognition is the process of distinguishing between nestmates and non-nestmates, and embodies the first line of defense for social insect colonies. In ants, nestmate recognition is widely thought to occur through olfactory cues found on the exterior surfaces of individuals. These cues, called cuticular hydrocarbons (CHCs), comprise the overwhelming majority of ant nestmate profiles and help maintain colony identity. In this dissertation, I investigate how nestmate recognition is influenced by evolutionary, ontogenetic, and environmental factors. First, I contributed to the sequencing and description of three ant genomes including the red harvester ant, Pogonomyrmex barbatus, presented in detail here. Next, I studied how variation in nestmate cues may be shaped through evolution by comparatively studying a family of genes involved in fatty acid and hydrocarbon biosynthesis, i.e., the acyl-CoA desaturases, across seven ant species in comparison with other social and solitary insects. Then, I tested how genetic, developmental, and social factors influence CHC profile variation in P. barbatus, through a three-part study. (1) I conducted a descriptive, correlative study of desaturase gene expression and CHC variation in P. barbatus workers and queens; (2) I explored how larger-scale genetic variation in the P. barbatus species complex influences CHC variation across two genetically isolated lineages (J1/J2 genetic caste determining lineages); and (3) I experimentally examined how CHC development is influenced by an individual’s social environment. In the final part of my work, I resolved discrepancies between previous findings of nestmate recognition behavior in P. barbatus by studying how factors of territorial experience, i.e., spatiotemporal relationships, affect aggressive behaviors among red harvester ant colonies. Through this research, I was able to identify promising methodological approaches and candidate genes, which both broadens our understanding of P. barbatus nestmate recognition systems and supports future functional genetic studies of CHCs in ants.