I have the following example:
Let $Y_1, \dots, Y_n$ be an i.i.d. $N(\mu, \sigma^2)$. Note that $\sum_{i = 1}^n (y_i - \mu)^2 = \sum_{i = 1}^n (y_i - \bar{y})^2 + n(\bar{y} - \mu)^2$.
We show that $\sum_{i = 1}^n (Y_i - \bar{Y})^2 \sim \sigma^2 \chi^2_{n - 1}$.
By the equality
$$\dfrac{1}{\sigma^2} \sum_{i = 1}^n (Y_i - \mu)^2 = \dfrac{1}{\sigma^2} \sum_{i = 1}^n (Y_i - \bar{Y})^2 + \dfrac{1}{\sigma^2} n(\bar{Y} - \mu)^2,$$
we have that the left-hand side is
$$\dfrac{1}{\sigma^2} \sum_{i = 1}^n (Y_i - \mu)^2 \sim \chi_n^2,$$
and the term in the right-hand side is
$$\dfrac{1}{\sigma^2} n(\bar{Y} - \mu)^2 \sim \chi_1^2,$$
and so $$\dfrac{1}{\sigma^2} \sum_{i = 1}^n (Y_i - \bar{Y})^2 \sim \chi_{n - 1}^2$$
How did the author conclude that $\sum_{i = 1}^n (y_i - \mu)^2 = \sum_{i = 1}^n (y_i - \bar{y})^2 + n(\bar{y} - \mu)^2$?