I have read in several papers, that one can regress the squared residuals of some conditional mean regression of a variable $X$ on a set of predictor variables and interpret the fitted values as the conditional variance of $X$. E.g.:
One can regress excess returns onto a set of conditioning variables. The resulting squared residuals then will be regressed onto the same set of conditioning variables. The conditional variance will be the fitted values from the second regression (Filipovic & Khalilzadeh, 2021).
What is the underlying logic here? The squared residuals are interpreted as the variance of $X$, correct? Also, why does it have to be the same set of conditioning variables. I have not yet come across this approach and I am unaware of the reasoning behind it.