The kidney has four main functions: excretory, homeostatic, endocrine, and metabolic. As part of its excretory function, the kidney removes waste from the bloodstream such as urea, uric acid, and creatinine. Its homeostatic functions include regulating blood volume and pressure, stabilizing ion concentrations and pH levels. The kidney also produces important hormones like erythropoietin and renin. Urine is formed through a process of filtration, reabsorption, and secretion as fluid passes through the nephron. Key components like water and electrolytes are reabsorbed while others like urea and drugs are excreted in the urine.