degrees of freedom
My takeaway from reading the whuber answer is that there is not a hard and fast procedure for moving from a problem statment to counting the degrees of freedom. Rather, the phrase "degrees of freedom" should clue me into an adjustment that needs to be made (see bessel's correction). That adjustment is usually necessary, because the naive or likely formula does not account for redundant information. We would not want to fool ourselves into thinking that we are taking independent samples for an estimator, when some of those datapoints are actually fully determined by the others. For example, when estimating the population variance, we use the sample mean in the formula. But if we use datapoints from that same sample to estimate the variance, then we should first adjust for the fact that only \((n-1)\) of the points actually contain new information.
I'm always confused how we move from knowing that an adjustment needs to be made to actually making the mathematical adjustment. For example, I'm confused how we know that the distribution of the residuals (the mean squared error of the sample mean) follows a chi squared distribution with \((n-1)\) degrees of freedom. As far as I can tell from marcelo ventura's answer, it just kind of falls out from the arithmetic.