The lecture notes by Lovász and Vesztergombi are unedited because their content ended up in the textbook Discrete Mathematics: Elementary and Beyond by Lovász, Pelikán, and Vesztergombi. The textbook has the correct equation at the corresponding point in the text: $$\binom k2 + \binom{n-k}{2} = \binom{n-1}{2} - (k-1)(n-k-1).$$
The follow-up is the same in both versions: when $1 \le k \le n-1$, we have $\binom k2 + \binom{n-k}{2} \le \binom{n-1}{2}$, with equality only if $k=1$ or $k=n-1$.
The corrected equation can be justified in two ways.
First, we may simply expand and simplify both sides to $\frac{n^2}{2} - \frac n2 + k^2 - kn$.
Second, combinatorially, consider the set of unordered pairs chosen from $\{1,\dots,k\}$ together with the set of unordered pairs from $\{k,\dots,n-1\}$; there are $\binom k2 + \binom{n-k}{2}$ of these. Which of the $\binom{n-1}{2}$ unordered pairs from $\{1,2,\dots,n-1\}$ are not included? Precisely the $(k-1)(n-k-1)$ pairs where one element is from $\{1,\dots,k-1\}$ and the other is from $\{k+1,\dots,n-1\}$.
[\binom{k}{2} + \binom{n - k}{2}] = \binom{n - 1}{2} - \frac{(k-1)(n-k-1)}{2} $ would be true, but with other values, the equality would totally crumble. It seems that the identetity isn't true. – oscar AMVS Apr 17 '22 at 00:17