Heart failure is a condition where the heart cannot effectively pump blood, leading to fluid accumulation in the body. When a person with heart failure lies down at night, this accumulated fluid shifts into the bloodstream, increasing blood volume and renal blood flow. The kidneys then work more efficiently to excrete this excess fluid, resulting in an increased frequency of urination, commonly known as nocturia.