Coefficient of $x^{n-2}$ in $(x-1)(x-2)(x-3)\dotsm(x-n)$

Finding the coefficient of $x^{n-2}$ requires picking $2$ terms from the product to multiply the constants. Thus, we get the coefficient to be $$ \begin{align} \sum_{k=2}^n\sum_{j=1}^{k-1}jk &=\sum_{k=2}^n\sum_{j=1}^{k-1}\binom{j}{1}k\\ &=\sum_{k=2}^n\binom{k}{2}k\\ &=\sum_{k=2}^n\binom{k}{2}((k-2)+2)\\ &=\sum_{k=2}^n\left(3\binom{k}{3}+2\binom{k}{2}\right)\\ &=3\binom{n+1}{4}+2\binom{n+1}{3}\\[3pt] &=\frac{(3n+2)(n^3-n)}{24} \end{align} $$


Observe that the coefficient of $x^1$ in $$(x-1)(x-2)(x-3)$$ is $$2\cdot3+1\cdot2+1\cdot3$$

or the coefficient of $x^{4-2}$ in $$(x-1)(x-2)(x-3)(x-4)=(x-1)(x-4)(x-2)(x-3)=(x^2-(1+4)x+1\cdot4)(x^2-(2+3)x+2\cdot3)$$

is $$2\cdot3+(1+4)(2+3)+1\cdot4$$

So, the required sum $$=\sum_{1\le r_1<r_2\le n}r_1r_2=\dfrac{(\sum_{r=1}^n r)^2-\sum_{r=1}^n r^2}2$$