Just to add some info on the physics side of the equation (and there is definitely psychology at play as well, as motivation plays a part in how hard you can ride).
There are plenty of references regarding how much the air resistance is reduced by following close behind a rider, plus anyone with a power meter will likely have seen similar data for themselves.
The amount the air drag is reduced does vary of course depending on a range of factors, but a typical reduction of ~30% when following close behind the rider in front is about right. It can of course be more or less than that. This reduction applies on climbs, flats and descents, but of course only applies to the proportion of power demand used to overcome air resistance.
So looking at the relative energy demand from the various resistance forces, I did this sample chart to show how that changes with gradient, for a rider + bike of 75kg and a steady power output of 300W and no wind (using the equations as described in the paper by Martin et al, Validation of a mathematical model for road cycling power):
Obviously the exact values for any individual will vary depending on their mass, aerodynamics, rolling resistance factors and so on. This is just to explain the principles involved - IOW the overall shape and trends shown will be the same for everyone.
So what we can see, e.g., is for such a rider on a 1% slope, a little over 60% of their energy output is used for overcoming air drag (300W x 61% = 183W), while on a 6% slope, that proportion of energy output drops to only ~10% (30W) as much more of their power is used to overcome the force of gravity.
Now the wattage "saving" by drafting closely behind another rider at those speeds, would be approximately 30% of the power used to overcome air resistance.
On the 1% gradient, that's ~30% x 183W = 50-60W, while on the 6% slope, that saving drops to 3-4W.
Now of course the fitter or more powerful the riders are, the faster they travel up hills at any given gradient, and so those relative wattage "savings" at each gradient from drafting behind another rider will increase.
As an example, if a rider with same weight etc was doing 400W on the 6% slope, the speed increases and the proportion of power used to overcome air resistance also goes up to 15-16% of total demand, in this case 62W, and ~30% of that = 15-20W.
A 15-20W saving when you are at your limit is substantial.
On an 8% grade this more powerful rider can attain a ~10W saving by drafting, and on a 10% slope they can still achieve a 5-7W saving.
Even 5-10W can be the difference between hanging on or cracking.