[proofplan]
We parameterize a spline by its initial jet of order $0,\dots,r-1$ at $x_0$ together with the constant $r$-th derivative on each polynomial piece. This gives $r+n$ scalar parameters. The main point is to prove that these parameters determine a unique spline and that every choice of parameters produces one. That gives an explicit linear isomorphism between the spline space and $\mathbb{R}^{r+n}$.
[/proofplan]
[step:Encode a spline by its initial derivatives and piecewise $r$-th derivatives]
Let $\mathcal{P}_r$ denote the real [vector space](/page/Vector%20Space) of polynomial functions $p:\mathbb{R}\to\mathbb{R}$ of degree at most $r$. For each $s\in S_r(x_0,\dots,x_n)$ and each $j\in\{1,\dots,n\}$, let $p_j\in\mathcal{P}_r$ be the unique polynomial function whose restriction to $[x_{j-1},x_j]$ equals $s|_{[x_{j-1},x_j]}$.
Since $\deg p_j\le r$, the derivative $p_j^{(r)}:\mathbb{R}\to\mathbb{R}$ is constant. For $m\in\{0,\dots,r-1\}$, the endpoint derivative $s^{(m)}(x_0)$ means $p_1^{(m)}(x_0)$, the derivative at $x_0$ taken from the first polynomial piece. Define the coordinate map $\Phi:S_r(x_0,\dots,x_n)\to \mathbb{R}^{r+n}$ by
\begin{align*}
\Phi(s)=\left(s(x_0),s'(x_0),\dots,s^{(r-1)}(x_0),p_1^{(r)},p_2^{(r)},\dots,p_n^{(r)}\right).
\end{align*}
Here $p_j^{(r)}$ denotes the constant value of the $r$-th derivative of $p_j$. The map $\Phi$ is linear because differentiation, restriction to a subinterval, and evaluation at $x_0$ are linear operations.
[/step]
[step:Construct a spline from arbitrary coordinates]
Fix arbitrary data $(y_0,\dots,y_{r-1},c_1,\dots,c_n)\in\mathbb{R}^{r+n}$. We construct a function $s:[a,b]\to\mathbb{R}$ in $S_r(x_0,\dots,x_n)$ whose image under $\Phi$ is this data.
First define numbers $y_{0,m}\in\mathbb{R}$ for $m\in\{0,\dots,r-1\}$ by $y_{0,m}=y_m$. Assume recursively that, for some $j\in\{1,\dots,n\}$, the left endpoint jet $(y_{j-1,0},\dots,y_{j-1,r-1})\in\mathbb{R}^r$ has been defined. Define a polynomial function $p_j:\mathbb{R}\to\mathbb{R}$ by
\begin{align*}
p_j(t)=\sum_{m=0}^{r-1}\frac{y_{j-1,m}}{m!}(t-x_{j-1})^m+\frac{c_j}{r!}(t-x_{j-1})^r.
\end{align*}
Then define the right endpoint jet by $y_{j,m}=p_j^{(m)}(x_j)$ for each $m\in\{0,\dots,r-1\}$.
Finally define $s:[a,b]\to\mathbb{R}$ by $s(t)=p_j(t)$ when $t\in[x_{j-1},x_j]$. This is well-defined at the knots because, for each interior knot $x_j$ with $j\in\{1,\dots,n-1\}$, the polynomial on the next interval is constructed so that
\begin{align*}
p_{j+1}^{(m)}(x_j)=y_{j,m}=p_j^{(m)}(x_j)
\end{align*}
for every $m\in\{0,\dots,r-1\}$. Therefore $s$ has matching derivatives of orders $0,\dots,r-1$ at every interior knot. More explicitly, for each such order the left-hand derivative from $p_j$ and the right-hand derivative from $p_{j+1}$ agree at $x_j$, so the glued piecewise-polynomial derivative is continuous at $x_j$. Hence $s\in C^{r-1}([a,b])$. Since each restriction $s|_{[x_{j-1},x_j]}$ agrees with $p_j\in\mathcal{P}_r$, we have $s\in S_r(x_0,\dots,x_n)$.
By construction, $s^{(m)}(x_0)=y_m$ for $m\in\{0,\dots,r-1\}$, and $p_j^{(r)}=c_j$ for $j\in\{1,\dots,n\}$. Hence $\Phi(s)=(y_0,\dots,y_{r-1},c_1,\dots,c_n)$.
[guided]
The construction is the heart of the dimension count. Instead of counting coefficients and subtracting constraints abstractly, we build the spline directly from exactly $r+n$ free numbers.
Choose arbitrary [real numbers](/page/Real%20Numbers) $(y_0,\dots,y_{r-1},c_1,\dots,c_n)\in\mathbb{R}^{r+n}$. The numbers $y_0,\dots,y_{r-1}$ will be the initial values of the derivatives $s(x_0),s'(x_0),\dots,s^{(r-1)}(x_0)$, and the number $c_j$ will be the constant value of the $r$-th derivative on the interval $[x_{j-1},x_j]$.
Set $y_{0,m}=y_m$ for every $m\in\{0,\dots,r-1\}$. Suppose the derivative data at the left endpoint $x_{j-1}$ of the $j$-th interval have already been defined: $(y_{j-1,0},\dots,y_{j-1,r-1})\in\mathbb{R}^r$. There is then a natural polynomial of degree at most $r$ with these initial derivatives and with $r$-th derivative equal to $c_j$, namely
\begin{align*}
p_j(t)=\sum_{m=0}^{r-1}\frac{y_{j-1,m}}{m!}(t-x_{j-1})^m+\frac{c_j}{r!}(t-x_{j-1})^r.
\end{align*}
Differentiating this formula $m$ times and evaluating at $t=x_{j-1}$ gives
\begin{align*}
p_j^{(m)}(x_{j-1})=y_{j-1,m}
\end{align*}
for every $m\in\{0,\dots,r-1\}$. Also, differentiating $r$ times gives the constant function
\begin{align*}
p_j^{(r)}(t)=c_j
\end{align*}
for all $t\in\mathbb{R}$.
Now define the derivative data at the right endpoint $x_j$ by
\begin{align*}
y_{j,m}=p_j^{(m)}(x_j)
\end{align*}
for each $m\in\{0,\dots,r-1\}$. These values become the left endpoint data for the next polynomial piece. Thus the next piece $p_{j+1}$ is forced to satisfy
\begin{align*}
p_{j+1}^{(m)}(x_j)=y_{j,m}=p_j^{(m)}(x_j)
\end{align*}
for every $m\in\{0,\dots,r-1\}$. This equality is exactly the $C^{r-1}$ matching condition at the knot $x_j$.
Define $s:[a,b]\to\mathbb{R}$ by setting $s(t)=p_j(t)$ on the interval $[x_{j-1},x_j]$. The matching identities above show that the pieces join with matching derivatives through order $r-1$ at every interior knot. For each $m\in\{0,\dots,r-1\}$, the one-sided $m$-th derivatives supplied by the two adjacent polynomial pieces agree at the knot, so the glued $m$-th derivative is continuous there. Hence $s\in C^{r-1}([a,b])$, and because each piece is a polynomial of degree at most $r$, we have $s\in S_r(x_0,\dots,x_n)$. Finally, the initial jet and the constants $p_j^{(r)}$ are exactly the chosen data, so $\Phi(s)$ is the original vector in $\mathbb{R}^{r+n}$.
[/guided]
[/step]
[step:Show that the coordinate map is injective]
Let $s\in S_r(x_0,\dots,x_n)$ satisfy $\Phi(s)=0$. Let $p_j\in\mathcal{P}_r$ denote the polynomial piece of $s$ on $[x_{j-1},x_j]$.
The equality $\Phi(s)=0$ gives $s^{(m)}(x_0)=0$ for every $m\in\{0,\dots,r-1\}$, and $p_j^{(r)}=0$ for every $j\in\{1,\dots,n\}$.
For $j=1$, the polynomial $p_1$ has derivative of order $r$ equal to $0$ and all derivatives of orders $0,\dots,r-1$ equal to $0$ at $x_0$. Therefore its Taylor expansion at $x_0$ has all coefficients equal to $0$, so $p_1=0$ on $\mathbb{R}$.
Since $s\in C^{r-1}([a,b])$, the derivatives of order $0,\dots,r-1$ match at $x_1$. Hence
\begin{align*}
p_2^{(m)}(x_1)=p_1^{(m)}(x_1)=0
\end{align*}
for every $m\in\{0,\dots,r-1\}$. Together with $p_2^{(r)}=0$, this gives $p_2=0$. Repeating this argument across the knots gives $p_j=0$ for every $j\in\{1,\dots,n\}$. Hence $s=0$ on $[a,b]$, so $\ker\Phi=\{0\}$.
[/step]
[step:Conclude the dimension from the explicit linear isomorphism]
The previous construction proves that $\Phi$ is surjective, and the injectivity argument proves that $\Phi$ has kernel $\{0\}$. Therefore $\Phi$ is a linear isomorphism from $S_r(x_0,\dots,x_n)$ onto $\mathbb{R}^{r+n}$. Consequently, $\dim_{\mathbb{R}} S_r(x_0,\dots,x_n)=\dim_{\mathbb{R}}\mathbb{R}^{r+n}=r+n$. This is the desired dimension formula.
[/step]