Heart failure occurs when cardiac output is insufficient to meet the body's metabolic needs or when the heart cannot adequately handle venous return, causing pulmonary congestion (in left ventricular failure), edema primarily in dependent tissues and abdominal viscera (in right ventricular failure), or both.