Urinary tract infection is the most diagnosed infection in older people. It accounts for more than 50% of antibiotic prescriptions in care homes and is a frequent reason for care home residents being hospitalised. This realist review developed and refined programme theories for preventing and recognising urinary tract infection, exploring what works, for whom and in what circumstances. The review used realist synthesis to explore existing literature on the detection and prevention of urinary tract infection, complemented by stakeholder consultation. It applies to the UK context, although other healthcare systems may identify synergies in our findings. Bibliographic databases searched included MEDLINE, CINAHL, EMBASE, Cochrane Library, Web of Science Core Collection (including the Social Sciences Citation Index), Sociological Abstracts, Bibliomap and National Institute for Health and Care Research Journals Library. Title and abstract screening were undertaken by two researchers independently of each other. Selection and assessment were based on relevance and rigour and cross-checked by a second researcher. Data extracted from the included studies were explored for explanations about how the interventions were considered to work (or not). Evidence tables were constructed to enable identification of patterns across studies that offered insight about the features of successful interventions. Programme theories were constructed through a four-stage process involving scoping workshops, examination of relevant extant theory, analysis and synthesis of primary research, teacher-learner interviews and a cross-system stakeholder event. A process of abductive and retroductive reasoning was used to construct context-mechanism-outcome configurations to inform programme theory. The scoping review and stakeholder engagement identified three theory areas that address the prevention and recognition of urinary tract infection and show what is needed to implement best practice. Nine context-mechanism-outcome configurations provided an explanation of how interventions to prevent and recognise urinary tract infection might work in care homes. These were (1) recognition of urinary tract infection is informed by skills in clinical reasoning, (2) decision-support tools enable a whole care team approach to communication, (3) active monitoring is recognised as a legitimate care routine, (4) hydration is recognised as a care priority for all residents, (5) systems are in place to drive action that helps residents to drink more, (6) good infection prevention practice is applied to indwelling urinary catheters, (7) proactive strategies are in place to prevent recurrent urinary tract infection, (8) care home leadership and culture fosters safe fundamental care and (9) developing knowledgeable care teams. We adapted our approach and work to online interactions with stakeholders and as a research team because of COVID-19. This also had an impact on bringing stakeholders together at a face-to-face event at the end of the project. Studies focusing on the prevention of urinary tract infection in care home settings were predominantly from the USA and Europe where the regulatory and funding systems for the long-term care of the elderly have some differences, particularly in the USA where national reporting plays a significant role in driving improvements in care. Care home staff have a vital role in the prevention and recognition of urinary tract infection, which can be enabled through integration and prioritisation within the systems and routines of care homes and delivery of person-centred care. Promoting fundamental care as a means of facilitating a holistic approach to prevention and recognition of urinary tract infection helps staff to recognise how they can contribute to antimicrobial stewardship and recognition of sepsis. Challenging assumptions made by staff about the presentation of urinary tract infection is complex and requires education that facilitates 'unlearning' and questioning of low-value practices. Programmes to prevent urinary tract infection need to be co-designed and supported through active and visible leadership by care home managers with support from specialist practitioners. We will focus on co-designing tools that facilitate implementation of our findings to ensure they fit with the care home context and address some of the challenges faced by care home leaders. This will underpin action at care home and system levels. Further research is needed to better understand the perspectives of residents and family carers, the effectiveness of non-pharmacological, pharmacological and specialist practitioner interventions and non-traditional approaches to training and educating the workforce in care home settings. This study is registered as PROSPERO CRD42020201782. This award was funded by the National Institute for Health and Care Research (NIHR) Health Technology Assessment programme (NIHR award ref: NIHR130396) and is published in full in Health Technology Assessment; Vol. 28, No. 68. See the NIHR Funding and Awards website for further award information.