Linear Regression of Indicator Matrix: sum of predictions is 1 In Element of Statistical Learning, chapter 4-2 about linear regression of an indicator matrix, it is stated that the sum of predictor is equal to 1.
To bring a bit of context:
We have $N$ training samples of size $p$ represented by a $N$ x $(p+1)$ matrix (intercept included) $\textbf{X}$. Each training sample $x_i$ belong to a category $g_i \in [| 1, .., K |]$. We use the $N$ x $K$ indicator matrix for the training samples which contains only one 1 per row. We try to fit a linear regression model for the parameter $\textbf{B}$ and we get $\hat{\textbf{B}} = (\textbf{X}^T\textbf{X})^{-1}\textbf{X}^T\textbf{Y}$.
For a new data, we compute the fitted output $\hat{f}(x)^T = (1,x^T)\hat{\textbf{B}}$ and the category is then $arg \max_{k \in [| 1, .., K |]} \hat{f}_k(x)$
They say that $\sum_{k \in [| 1, .., K |]} \hat{f}_k(x) = 1$ for any $x$  as long as there is an intercept in the model.
My question is thus why? I try to use the coefficient relation from the regression derivation ($\textbf{X}^T(\textbf{Y} - \textbf{X}\hat{\textbf{B}}) = 0$) but without success.
 A: The intercept in the model (a column of 1's in X) is the key.
Write $\hat{Y} = \hat{f}_k(X)$ as the fit of $Y$. 
\begin{equation*}
\begin{split}
\sum_{k \in \{1, .., K\}} \hat{f}_k(X) &= \hat{Y}\cdot\textbf{1}_{K} \\
& = X(X^TX)^{-1}X^TY\cdot\textbf{1}_{K} \\
& = P\cdot\textbf{1}_{N}
\end{split}
\end{equation*}
where $\textbf{1}_{K}$ is a vector of 1 of dimension $K$, $Y\cdot\textbf{1}_{K}=\textbf{1}_{N}$ because $Y$ is an indicator matrix, and $P=X(X^TX)^{-1}X^T$ is the projection matrix. $Pa$ is the projection of vector $a$ onto the column space of $X$.
If there is an intercept in the model, then ${1}_{N}$ is in the column space of $X$, thus $\sum_{k \in \{1, .., K\}} \hat{f}_k(X)= P\cdot\textbf{1}_{N} = \textbf{1}_{N}$.
And for each observation $x$ in $X$, $\sum_{k \in \{1, .., K\}} \hat{f}_k(x)= 1$.
A: Yeah, it is straighforward if you're familiar with centered model (or form) of $X$.

Consider that we have $K$ (ranges from $1, ..., K$) classes in our problem; As you showed, we compute a fitted output through the equation (however, a more compact notation is $\hat{f}_k(x)^T$ that  denotes the discriminant of the $k$ class):
$$\hat{f}_k(x)^T = (1,x^T)\hat{\textbf{B}}$$
That is equivalent to:
$$(1,x^T)\begin{bmatrix}\hat{\textbf{B}}_{0} \\ \hat{\textbf{B}}_{1\sim k}\end{bmatrix}$$
Also, if we decompose $\hat{\textbf{B}}$ to its original equation (i.e., by optimizing it using the least mean squares), i.e., that  is:
$$\hat{\textbf{B}} = (X^TX)^{-1}X^TY_{N \times K}$$
So the whole new equation is:
$$\hat{f}_k(x)^T = {\hat{\textbf{B}}_{0}}_{1 \times K} + x^T_{1 \times p}(X^TX)^{-1}X^TY_{N \times K}$$
And it's completely okay to use a centered form of $X$ (by subtracting each observation from the mean vector) instead of the original one.
$$\hat{f}_k(x)^T = {\hat{\textbf{A}}_{0}}_{1 \times K} + {x_c^T}_{1 \times p}(X^T_c X_c)^{-1}X_c^TY_{N \times K}$$
${\hat{\textbf{A}}_{0}}_{1 \times K}$ is the intercept vector in the centered form.
$\hat{f}_k(x)^T$ by a vector of ones, i.e., $\textbf{1}_{K \times 1}$, and we multiply it by the whole equation, so that it becomes:
$$\hat{f}_k(x)^T\textbf{1}_{K \times 1} = {\hat{\textbf{A}}_{0}}_{1 \times K}\textbf{1}_{K \times 1} + {x_c^T}_{1 \times p}(X^T_c X_c)^{-1}X_c^TY_{N \times K}\textbf{1}_{K \times 1}$$
$Y_{N \times K}$ is a matrix where each row has only single 1. So $Y_{N \times K}\textbf{1}_{K \times 1} = {1}_{N \times 1}$, and hence, the equation is:
$$\hat{f}_k(x)^T\textbf{1}_{K \times 1} = {\hat{\textbf{A}}_{0}}_{1 \times K}\textbf{1}_{K \times 1} + {x_c^T}_{1 \times p}(X^T_c X_c)^{-1}\underbrace{X_c^T\textbf{1}_{N \times 1}}_{\text{sum of centered values = 0}}$$
And since ${\hat{\textbf{A}}_{0}}_{1 \times K}$ is nothing but a vector of all zeros and one at the correct class index, then:
$$\hat{f}_k(x)^T\textbf{1}_{K \times 1} = \underbrace{{\hat{\textbf{A}}_{0}}_{1 \times K}\textbf{1}_{K \times 1}}_{\text{1}} = 1 \tag*{Q.E.D $\blacksquare$}$$
A: $(1,x^T)\hat{B}\mathbf{1}_{K\times1} = 1$ should hold for any $x \in \mathbb{R}^{p}$ rather than $x$ in the training set.
Since $\mathbf{X}' = [\mathbf{1}_{N \times 1}, \mathbf{X}_{N \times p}] $,
$\begin{align*}\hat{B}\mathbf{1}_{K \times 1} &= (\mathbf{X}'^T\mathbf{X}')^{-1}\mathbf{X}'^T \mathbf{Y}\mathbf{1}_{K \times 1} \\
&=\begin{bmatrix}
N & \mathbf{1}_{N \times 1}^T \mathbf{X}\\
\mathbf{X}^T \mathbf{1}_{N \times 1}& \mathbf{X}^T\mathbf{X}
\end{bmatrix}^{-1}
\begin{bmatrix}
\mathbf{1}_{N \times 1}^T \\
\mathbf{X}^T 
\end{bmatrix} \mathbf{1}_{N \times 1}\\
&= 
\begin{bmatrix}
N & \mathbf{1}_{N \times 1}^T \mathbf{X}\\
\mathbf{X}^T \mathbf{1}_{N \times 1}& \mathbf{X}^T\mathbf{X}
\end{bmatrix}^{-1}
\begin{bmatrix}
N \\
\mathbf{X}^T \mathbf{1}_{N \times 1}
\end{bmatrix}
\end{align*}$.
Recall $\begin{bmatrix}
N & \mathbf{1}_{N \times 1}^T \mathbf{X}\\
\mathbf{X}^T \mathbf{1}_{N \times 1}& \mathbf{X}^T\mathbf{X}
\end{bmatrix}^{-1}
\begin{bmatrix}
N & \mathbf{1}_{N \times 1}^T \mathbf{X}\\
\mathbf{X}^T \mathbf{1}_{N \times 1}& \mathbf{X}^T\mathbf{X}
\end{bmatrix} =
\mathbf{I}_{(p+1) \times (p+1)}
 $, and $
\begin{bmatrix}
N \\
\mathbf{X}^T \mathbf{1}_{N \times 1}
\end{bmatrix}
$ is the first column $\implies \hat{B}\mathbf{1}_{K \times 1} = \begin{bmatrix}
1 \\
\mathbf{0}_{p \times 1}
\end{bmatrix}$, and $(1,x^T)\hat{B}\mathbf{1}_{K\times1} = 1$.
