At any moment, half of the moon is lit by the sun, and that is true of both the near side and the far side. The sun lights a sphere from one direction, so the illuminated half always faces the sun and the other half faces away. The moon makes no light of its own; it reflects sunlight. From Earth, the fraction of the lit half observers can see changes through the month, and that changing fraction is what produces the phases. At new moon the illuminated half faces away from Earth; at full moon it faces Earth. The far side is never in permanent shadow. It receives the same sunlight the near side does whenever it faces the sun, and it is dark only when it faces away, just as the near side is. Rotation carries the far side into sunlight and back out again, so every point on it cycles through day and night the same way a point on the near side does.
The phrase "dark side of the moon" names something different: the hemisphere that never faces Earth. Dark there means hidden, not unlit. The two ideas, unseen and unlit, are easy to merge, and popular usage has merged them.
The moon is tidally locked to Earth. It turns on its axis once every 27.3 days, and it completes one orbit of Earth in the same 27.3 days. Rotation and orbit keep pace with each other, so the same hemisphere always faces Earth and the far side always faces away. Any point on the far side rotates into sunlight and back out again as the moon turns. The far side is not hidden by Earth's shadow; it is simply turned away from Earth. Earth's shadow touches the moon only during a lunar eclipse, a rare alignment of sun, Earth, and moon. The moon's rotation and orbit are synchronized by tidal forces, not by coincidence.
Locking was not instant. The moon formed about 4.5 billion years ago spinning far faster than it does now. Earth's gravity raises a solid tidal bulge in the moon, distorting it from a sphere into a shape closer to a lemon, with the pinched end pointed at Earth. While the young moon spun quickly, that bulge migrated across the surface much as ocean tides move around the globe. The constant shifting acted as a brake, slowing the moon's spin until it fell into step with its orbital period. At that point the hemisphere facing Earth was locked in place.
The moon is not a perfect sphere, so its mass is unevenly distributed. As it rotates, gravity pulls on those irregularities and produces a torque that springs the moon back toward alignment, a wobble known as lunar libration. Libration lets observers see slightly more than half of the moon's surface over time, never the whole far side at once. The extra sliver appears along the moon's edges, and it shifts position from month to month.
The far side stayed unseen until 1959, when the Soviet Luna 3 spacecraft returned the first photographs of it. Before that mission, the terrain was entirely unknown. Later spacecraft, including the Lunar Reconnaissance Orbiter, mapped it closely, and it does not resemble the near side. The far side is older and more heavily cratered, with a surface saturated by impacts. Craters accumulate over time, so a heavily cratered surface is generally an older one, and on the far side later impacts have erased many older craters in turn.
Cooling is the leading explanation. Scientists think the young moon was molten, then solidified over time. The far side cooled first, leaving it older and more heavily cratered than the near side. The near side also has more radiation than the far side, and researchers do not fully know why; that difference may have contributed to the near side cooling more slowly. NASA has also released photographs of the far side taken by the Deep Space Climate Observatory, a satellite positioned between the sun and the moon with Earth in the frame. Those images show the far side fully lit, with Earth as a backdrop, the reverse of the view from the ground.