Complicated urinary tract infections (UTIs) occur in the setting of a urinary tract that has metabolic, functional, or structural abnormalities. Complicated UTIs may involve both lower and upper tracts .Their primary significance is that they significantly increase the rate of therapy failures.
The pathophysiology of complicated UTIs has the following 4 aspects:
Structural abnormalities, such as calculi, infected cysts, renal/bladder abscesses, certain forms of pyelonephritis, spinal cord injury (SCI), and catheters
Metabolic/hormonal abnormalities, such as diabetes and pregnancy
Impaired host responses, such as transplant recipients (especially renal transplants) and patients with AIDS
Unusual pathogens, such as yeast
A growing number of complicated UTIs are healthcare associated in origin. The most common pathogens include Escherichia coli, enterococci, Pseudomonas aeruginosa, candidal species, and Klebsiella pneumoniae.
Pyelonephritis is almost always the result of bacteria migrating from the bladder to the renal parenchyma, which is enhanced by vesicourethral reflux. In uncomplicated pyelonephritis, the bacterial invasion and renal damage are limited to the pyelocalyceal-medullary region; in complicated pyelonephritis, all regions of the kidney may be affected. If the infection progresses, bacteria may invade the bloodstream, resulting in bacteremia. [1, 2]
Patients with a neurogenic bladder or bladder diverticulum and postmenopausal women with bladder or uterine prolapse have an increased frequency of urinary tract infection because of incomplete bladder emptying. This eventually allows residual bacteria to overwhelm local bladder mucosal defenses.
Autosomal dominant polycystic kidney disease can lead to end-stage renal disease. Cysts may become infected from either bacteremia or bacteriuria.
Subclinical pyelonephritis should be considered in patients with any of the following risk factors:
History of pyelonephritis
UTI before age 12 years
More than 3 UTIs in the past year
In patients with diabetes mellitus, high urine glucose content and defective host immune factors predispose to infection. Hyperglycemia causes neutrophil dysfunction by increasing intracellular calcium levels and interfering with actin and, thus, diapedesis and phagocytosis.Associated vaginal candidiasis and vascular disease also play a role in recurrent infections.
Patients with diabetes may develop emphysematous or xanthogranulomatous pyelonephritis and necrotizing papillitis. Over time, patients with diabetes may develop cystopathy, nephropathy, and renal papillary necrosis, complications that predispose them to UTIs. Long-term effects of diabetic cystopathy include vesicourethral reflux and recurrent UTIs; as many as 30% of women with diabetes have some degree of cystocele, cystourethrocele, or rectocele. 
For more information on this topic, see the Medscape Reference article Urinary Tract Infections in Diabetes Mellitus.
Calculi related to UTIs (see the image below) most commonly occur in women with recurrent UTIs from Proteus, Pseudomonas, and Providencia species. Bacterial biofilms serve to assist struvite growth. Because magnesium ammonium phosphate is acid soluble, stone formation does not tend to occur with a urinary pH lower than 7.19.
Increases in ammonia raise the pH and injure the uroepithelial glycosaminoglycan layer, enhancing bacterial adherence. Alkalinity also increases the amount of phosphate and carbonate available to bind calcium and magnesium and so promote stone formation.
Focal and Multifocal Nephritis
Acute focal bacterial nephritis is also known as acute lobar nephronia or focal pyelonephritis (see the image below). This is an acute bacterial interstitial nephritis affecting a single renal lobe.
Acute multifocal bacterial nephritis affects more than 1 lobe. Emphysematous pyelonephritis is a severe, necrotizing form of acute multifocal bacterial nephritis.  Retroperitoneal (ie, extraluminal) gas may be observed in the renal parenchyma and perirenal space on radiographs. This is observed most commonly in people with diabetes, but it also may be observed in patients with immunocompromise or obstruction. [5, 6]
Xanthogranulomatous pyelonephritis is a severe chronic infection of the renal parenchyma. The kidney is enlarged and is fixed to the retroperitoneum by either perirenal fibrosis or an extension of the granulomatous process.
The inciting event in xanthogranulomatous pyelonephritis appears to be renal obstruction leading to a chronic UTI. Predisposing factors include renal calculi, lymphatic obstruction, renal ischemia, dyslipidemia, diabetes, and primary hyperparathyroidism.  .The pathological hallmark is the lipid-laden macrophage. This most likely represents a defect of intracellular killing. The chronic inflammation leads to massive destruction of the kidney.
The classic appearance of xanthogranulomatous pyelonephritis on CT scan is that of low-density areas surrounded by a 2-1 that is enhanced by contrast. It often takes a tissue diagnosis to differentiate this process from renal cell carcinoma. 
A perinephric abscess is defined as a collection of purulent material between the renal capsule and Gerota fascia. A perinephric abscess may develop secondary to an intrarenal abscess, a renal cortical abscess, xanthogranulomatous pyelonephritis, or chronic or recurrent pyelonephritis or from hematogenous dissemination. Predisposing factors are similar to those for intrarenal abscess. Approximately 25% of patients have diabetes. 
Renal corticomedullary abscesses usually are associated with vesicoureteral reflux or urinary tract obstruction, and the usual organisms include Escherichia coli, Klebsiella species, and Proteus species. Clinical syndromes include acute focal bacterial nephritis, acute multifocal bacterial nephritis, emphysematous pyelonephritis, and xanthogranulomatous pyelonephritis.
Renal cortical abscesses (ie, renal carbuncles) usually result from hematogenous spread of bacteria. Primary sources of infection include skin infections, osteomyelitis, and endovascular infections. These are observed commonly in users of injection drugs, people with diabetes, and patients on dialysis. The most common organism isolated is Staphylococcus aureus. Ten percent of cortical abscesses may rupture through the renal capsule and form a perinephric abscess. 
Renal cortical abscesses (ie, renal carbuncles) usually result from hematogenous spread of bacteria. Primary sources of infection include skin infections, osteomyelitis, and endovascular infections. These are observed commonly in users of injection drugs, people with diabetes, and patients on dialysis. The most common organism isolated is Staphylococcus aureus. Ten percent of cortical abscesses may rupture through the renal capsule and form a perinephric abscess.
Several factors increase the risk of UTI in pregnancy. These factors include relative obstruction of the ureters (secondary to the enlarging uterus), smooth muscle relaxation of the ureter and bladder (secondary to progesterone), and aminoaciduria and glycosuria, which provide a favorable environment for bacteria to grow. 
E coli is the most common organism isolated from cultures, although Proteus mirabilis and Klebsiella pneumoniae also are observed. Less common agents include group B streptococci and Staphylococcus saprophyticus. Group B streptococci are isolated in approximately 5% of infections and have been linked to preterm labor; these patients should receive prophylactic antibiotics during delivery to reduce the risk of neonatal sepsis. 
For more information on this topic, see the Medscape Reference article Urinary Tract Infections in Pregnancy.
Risk factors for candiduria include diabetes mellitus, indwelling urinary catheters, and antibiotic use. The presence of Candida species in the urine usually represents colonization and not infection, and as such, not all patients with candiduria require treatment. A lower threshold for initiating treatment exists for patients with diabetes, a history of renal transplantation, or genitourinary abnormalities.