Why a regression of OLS residuals on regressors, yields a $R^2$ of 0? In a regression of residuals
on X, the OLS estimator would be $\hat{\gamma} = (X'X)^{−1}X'\hat{\varepsilon}$ which is a vector of zeros ($\hat{\gamma} = 0$)
since $X'\hat{\varepsilon} = 0$. Could anyone tell me how did we arrive to the above conclusion about the OLS estimator?

The OLS estimates are solutions to
$$ \hat{\beta} = \min_{\beta\in\mathbb{R^n}} (y-X\beta)^T(y-X\beta) $$
You an show that the estimates also satisfy
$$ 0 = 2X^T(y-X\beta) $$
by differentiating the first equation with respect to $\beta$ and setting the resulting gradient to 0.
Now, note that $\varepsilon = (y-X\beta)$.  The consequence is that the residual is orthogonal to the columns of $X$.
Note also that $\beta = (X^TX)^{-1}X'y$.  If we regress the data onto the residual (yielding estimates $\beta_{\varepsilon}$) , then the orthogonality we're discovered means $\beta_{\varepsilon}=0$, which means the predicted residual $X\beta_{\varepsilon}=0$.
There is then no variation in $X\beta_{\varepsilon}$ and hence no variation in the residuals explained by $X$.
