A very important question in immunology is to determine which factors decide whether an immune response can efficiently clear or control a viral infection, and under what circumstances we observe persistent viral replication and pathology. This paper summarizes how mathematical models help us gain new insights into these questions, and explores the relationship between antiviral therapy and long–term immunological control in human immunodeficiency virus (HIV) infection. We find that cytotoxic Tlymphocyte (CTL) memory, defined as antigen–independent persistence of CTL precursors, is necessary for the CTL response to clear an infection. The presence of such a memory response is associated with the coexistence of many CTL clones directed against multiple epitopes. If CTL memory is inefficient, then persistent replication can be established. This outcome is associated with a narrow CTL response directed against only one or a few viral epitopes. If the virus replicates persistently, occurrence of pathology depends on the level of virus load at equilibrium, and this can be determined by the overall efficacy of the CTL response. Mathematical models suggest that controlled replication is reflected by a positive correlation between CTLs and virus load. On the other hand, uncontrolled viral replication results in higher loads and the absence of a correlation between CTLs and virus load. A negative correlation between CTLs and virus load indicates that the virus actively impairs immunity, as observed with HIV. Mathematical models and experimental data suggest that HIV persistence and pathology are caused by the absence of sufficient CTL memory. We show how mathematical models can help us devise therapy regimens that can restore CTL memory in HIV patients and result in long–term immunological control of the virus in the absence of life–long treatment.