The heat flow equation
Steady heat flow through a wall is Q = A x delta T / R. A is area in square feet, delta T is the temperature difference in °F and R is the total thermal resistance in ft²·°F·h/Btu. The U-factor is simply 1/R, the heat flow per square foot per degree.
This is a simplified model of one uniform wall. Real walls lose extra heat through wood studs (thermal bridging), windows and air leaks, which is why energy codes now often call for continuous insulation outside the studs.
Diminishing returns
Because R sits in the denominator, each added R saves less than the one before. Going from R-1 to R-5 saves far more energy than going from R-20 to R-40, which is why recommended R-values depend on climate and on what is already in the wall.