Solution (source code)

= Solution

Write $\alpha=1-1/r$. The <Erdős-Stone theorem> states that, for a fixed <graph> $F$ with <chromatic number> $\chi(F)=r+1\geq2$,
$$
\boxed{\operatorname{ex}(n,F)=\left(1-\frac1r+o(1)\right)\binom n2.}
$$
Here $\operatorname{ex}$ is the <extremal number>, and copies are <subgraphs>, not necessarily <induced subgraphs>. We write $K_a(b)$ for the <balanced complete multipartite blow-up> with $a$ classes of $b$ <vertices> each. All asymptotic errors below concern $n\to\infty$ with the forbidden <graphs> fixed.

\b[The stability subgraph.] We prove the <high-minimum-degree multipartite stability subgraph> assertion directly from the <Erdős-Stone theorem>. For $r=1$, the edgeless spanning <subgraph> suffices. Suppose $r\geq2$.

First repeatedly remove a <vertex> whose <degree of a vertex> is less than $(\alpha-\varepsilon_n)$ times the current order, where $\varepsilon_n\to0$ sufficiently slowly. The <Erdős-Stone theorem> gives, uniformly for every $K_{r+1}(t)$-free <subgraph> $J$ of order at most $n$,
$$
e(J)\leq\frac\alpha2|J|^2+\eta_n n^2,\qquad \eta_n\to0.
$$
Indeed, apply the asymptotic bound at large orders; the contribution from bounded or sufficiently small orders is negligible relative to $n^2$. If $m$ <vertices> survive, the removed <edges> number at most
$$
(\alpha-\varepsilon_n)\sum_{j=m+1}^n j
=\frac{\alpha-\varepsilon_n}{2}(n^2-m^2)+O(n).
$$
Comparing with $e(G_n)=\alpha n^2/2+o(n^2)$ shows that $\varepsilon_n(n^2-m^2)=o(\varepsilon_n n^2)$, provided $\varepsilon_n$ dominates $\eta_n$, the initial relative error, and $1/n$. Consequently $m=n-o(n)$. The surviving <induced subgraph> $G'$ satisfies $\delta(G')\geq(\alpha-o(1))m$ and $e(G')=\alpha m^2/2+o(m^2)$.

By the <Erdős-Stone theorem>, $G'$ contains $K_r(L)$ for some $L=L_n\to\infty$ as slowly as necessary. This follows because $\alpha$ exceeds the <extremal number> density for each fixed $K_r(L)$ by the positive gap $1/(r(r-1))$. Choose $L$ so slowly that $rL=o(m)$ and $\binom Lt^r=o(m)$, and denote its root classes by $A_1,\ldots,A_r$.

An outside <vertex> having at least $t$ <neighbours of a vertex> in every $A_i$ determines one choice of a $t$-subset in each $A_i$. At most $t-1$ outside <vertices> can determine any fixed choice, since otherwise these <vertices> and the chosen root sets form $K_{r+1}(t)$. Thus at most $(t-1)\binom Lt^r=o(m)$ outside <vertices> have this property. Exclude those <vertices> and the root classes; put each remaining <vertex> in a class $C_i$ for which it has fewer than $t$ <neighbours of a vertex> in $A_i$.

Write $\delta(G')\geq(\alpha-\gamma_n)m$, with $\gamma_n\to0$. Counting missing incidences with $A_i$ gives
$$
(L-t+1)|C_i|\leq\sum_{u\in A_i}(m-d(u))\leq L(1/r+\gamma_n)m.
$$
Since $\sum_i|C_i|=m-o(m)$, it follows that $|C_i|=m/r+o(m)$ for every $i$. The total missing incidences from all root <vertices> to assigned <vertices> are at most $(1+r\gamma_n)Lm$. At least $(L-t+1)(m-o(m))$ of them are incidences with a <vertex>'s own assigned root class. Hence only $o(Lm)$ missing incidences go to other root classes.

Choose $\rho_n\to0$ slowly and discard the $o(m)$ assigned <vertices> with more than $\rho_n L$ missing incidences to other root classes. Each remaining <vertex> of $C_i$ is adjacent to all but at most $\rho_n L$ <vertices> of every $A_j$, $j\ne i$. If its class contained a <complete bipartite graph> $K_{t,t}$, the $2t$ <vertices> of this copy would have at least $L-2t\rho_n L\geq t$ common <neighbours of a vertex> in each other root class. These sets extend the copy to $K_{r+1}(t)$, a contradiction. By the bipartite case of the <Erdős-Stone theorem>, the number of internal <edges> in each surviving class is $o(m^2)$.

The surviving <graph> still has $\alpha m^2/2+o(m^2)$ <edges>, whereas the total possible cross-class <edges>, with these balanced classes, is $\alpha m^2/2+o(m^2)$. Thus only $o(m^2)$ cross-class <edges> are missing. Discard the $o(m)$ <vertices> missing more than $\sigma_n m$ cross-class <edges>, with $\sigma_n\to0$ slowly, and delete all internal <edges>. The resulting $r$-partite <subgraph> $H$ has classes $H_i$ of size $n/r+o(n)$ and
$$
\boxed{|H|=n-o(n),\qquad \delta(H)=(1-1/r+o(1))n.}
$$
For the lower bound, every surviving <vertex> misses only $o(n)$ <vertices> outside its class; the upper bound follows from the class sizes. This also records the uniform cross-class error that we need next.

\b[Minimum degree in an extremal graph.] Fix $F$ with $\chi(F)=r+1$. Choose $t$ large enough that $F$ embeds in $K_{r+1}(t)$. An extremal $F$-free <graph> $G$ is therefore $K_{r+1}(t)$-free, and its <edge> count has the required asymptotics by the <Erdős-Stone theorem>. For $r\geq2$ take $H$ as above.

For any <vertex> $v$, remove $v$ and introduce a new <vertex> $v^*$ whose <vertex neighbourhood> consists precisely of the <vertices> in $H_2\cup\cdots\cup H_r$ other than $v$. The new <degree of a vertex> is $\alpha n-o(n)$. This new <graph> remains $F$-free. Indeed, a new copy of $F$ must use $v^*$, and all its <neighbours of a vertex> in that copy lie in the other classes of $H$. There are only boundedly many of them. Each misses only $o(n)$ <vertices> in $H_1$, so an unused <vertex> $w\in H_1$ is adjacent to all of them. Replacing $v^*$ by $w$ would give $F$ in $G-v$, which is impossible.

Extremality now forces $d_G(v)\geq\alpha n-o(n)$, uniformly in $v$. The upper bound for the <minimum degree of a graph> follows from $\delta(G)\leq2e(G)/n$. For $r=1$, $e(G)=o(n^2)$ already gives $0\leq\delta(G)=o(n)$. Thus
$$
\boxed{\delta(G)=(1-1/r+o(1))n.}
$$
This is the <minimum degree of an extremal forbidden-subgraph graph> principle.

\b[The exact extremal graph for disjoint cliques.] Define
$$
J_s(n)=K_{s-1}+T_r(n-s+1),\qquad
b_s(n)=\binom{s-1}{2}+(s-1)(n-s+1)+e(T_r(n-s+1)).
$$
The plus sign denotes the <join of graphs>. The <Turán graph> contains no $K_{r+1}$, so every such <clique> in $J_s(n)$ uses a <vertex> of $K_{s-1}$. Therefore $J_s(n)$ contains no $s$ vertex-disjoint such <cliques>, and the <extremal number> is at least $b_s(n)$.

Induct on $s$, with $s=1$ supplied by the <Turan theorem>, including its equality characterization. Let $s\geq2$ and let $G$ be extremal for $sK_{r+1}$. The preceding results give $\delta(G)\geq\alpha n-o(n)$ and the $r$-partite <subgraph> $H$. Keep its classes $H_i$ fixed and assign each of the remaining $o(n)$ <vertices> to a class in which it has fewest <neighbours of a vertex> in $H$. Write the resulting classes as $C_i$; all have size $n/r+o(n)$. Choose a positive $\tau_n\to0$ so slowly that $\tau_n n$ dominates the outside count, every cross-class error in $H$, and every error in the <minimum degree of a graph> bound.

Suppose some <vertex> $x\in C_i$ has at least $\tau_n n$ internal <neighbours of a vertex>. If $x\notin H$, the assignment rule shows that $x$ has at least $\tau_n n-o(n)$ <neighbours of a vertex> in every $H_j$. If $x\in H_i$, it has this many in $H_i$ and $n/r-o(n)$ in the other $H_j$. If $G-x$ contained $s-1$ disjoint $K_{r+1}$, we could choose one <vertex> in each $N(x)\cap H_j$, successively avoiding those copies and the $o(n)$ missing cross-neighbours of the already chosen <vertices>. This produces a further $K_{r+1}$ through $x$. For $r=1$, this just chooses an unused neighbour of $x$. Hence $G-x$ is $(s-1)K_{r+1}$-free, and induction gives
$$
e(G)\leq b_{s-1}(n-1)+(n-1)=b_s(n).
$$
Since the candidate attains $b_s(n)$, equality holds throughout: $x$ is a <universal vertex> and $G-x$ is the inductively unique extremal <graph>. Thus $G$ is isomorphic to $J_s(n)$.

It remains to show that this case must occur. Otherwise all internal <vertex degrees> are less than $\tau_n n=o(n)$. Together with the lower bound on $\delta(G)$ and $|C_i|=n/r+o(n)$, this implies that every <vertex> misses only $o(n)$ <vertices> outside its own class. If some $C_i$ contains a <matching in a graph> of $s$ <edges>, extend its <edges> one by one to $K_{r+1}$, choosing one <vertex> from each other class. At every step only $o(n)$ cross-neighbours and boundedly many used <vertices> are excluded. This gives $s$ disjoint forbidden <cliques>, a contradiction.

A <maximal matching> in each class therefore has at most $s-1$ <edges>, and its at most $2(s-1)$ endpoints form a <vertex cover> of the internal <edges>. Their internal <vertex degrees> are all $o(n)$, so the total internal <edge> count is $o(n)$. The cross-class <edge> count is at most $e(T_r(n))$, whence
$$
e(G)\leq e(T_r(n))+o(n).
$$
But the balanced part sizes of the <Turán graph> give
$$
b_s(n)-e(T_r(n))=\frac{s-1}{r}n+O(1),
$$
contradicting extremality for $s\geq2$. This argument also works for $r=1$. Consequently, for all sufficiently large $n$,
$$
\boxed{\operatorname{ex}(n,sK_{r+1})=b_s(n),\quad G\cong K_{s-1}+T_r(n-s+1).}
$$
The uniqueness is up to <isomorphic graphs>, as usual for an <extremal graph for disjoint cliques>.