Walvis Bay in Namibia is an estuary, protected from the harsh waves of the ocean, and controlled by tides. The tidal waters force fish into the inlet where they cannot easily escape and become food for the abundant birds that inhabit the inlet. But what does that have to do with the kidney?
After the blood is filtered in the glomerulus, it passes down through a long tubule that winds into the center (medulla) of the kidney and then upward again.
Water is abstracted from the descending tubule, and by the time the filtrate reaches the center of the medulla, the salt content in the tubule is very high. Like the fish entering the estuary with the tides, the sodium molecules become stuck in the tubule and must diffuse out into the space that surrounds them. For the fish, the fate is much worse; they become part of the food chain. As the tubule winds back upward more and more sodium is pumped into the medulla of the kidney so that by the time the tubule reaches the outer part of the kidney, the fluid in the tubule has become diluted, but the fluid in the deep part of the kidney has become concentrated.
On a hot summer day when you have been outside in the heat but not drinking enough water, you become thirsty and also concentrate your urine. This is all controlled by the brain. As shown in the diagram below, the concentration of urine is controlled when the antidiuretic hormone (ADH), is released from the pituitary gland in the brain in response to a signal that you are dehydrated and starts adding pores into the wall of the distal collecting duct. Since the concentration in the medulla is very high, the diluted fluid is reabsorbed through these open pores, resulting in concentrated urine. On the other hand, when you drink an excess amount of water, the pituitary releases less ADH, and the pores close, letting diluted tubule fluid pass into the urine.