Let $n$ be an even integer. Find the number of ways to select four distinct integers $a$, $b$, $c$, $d$ between $1$ and $n$, inclusive, satisfying $a+c=b+d$. Order of these four numbers does not matter.
Without loss of generality, assuming $a < c$ and $b < d$. Let $s=a+c=b+d$. Then it must hold that $5\le s\le (2n-3)$. The middle value of $s$ is $(n+1)$.
- When $s < (n+1)$, both $a$ and $b$ must be chosen from $1$ and $\left\lfloor{\frac{s-1}{2}}\right\rfloor$, inclusive.
- When $s > (n+1)$, both $c$ and $d$ must be chose from $\left\lfloor{\frac{s-1}{2}}\right\rfloor$ to $n$, inclusive.
- When $s = (n+1)$, choosing $a$ and $b$ first or $c$ and $d$ first will result the same.
When either $a$ and $b$, or $c$ and $d$ are chosen, the other two values will be determined too because their respective sums are $s$. So, when $s$ loops through $5$, $6$, $\cdots$, $(2n-4)$, $(2n-3)$, the number of possible selections will be $$\binom{2}{2},\ \binom{2}{2},\ \cdots,\ \binom{\lfloor\frac{n}{2}\rfloor -1}{2},\ \binom{\lfloor\frac{n}{2}\rfloor -1}{2},\binom{\lfloor\frac{n}{2}\rfloor}{2}\ \binom{\lfloor\frac{n}{2}\rfloor -1}{2},\ \ binom{\lfloor\frac{n}{2}\rfloor -1}{2},\ \cdots \binom{2}{2}, \binom{2}{2}$$
It follows that their sum, i.e. the final result, is $$\begin{align*} &4\left(\binom{2}{2}+\binom{3}{2} + \cdots + \binom{\lfloor\frac{n}{2}\rfloor-1}{2}\right) + \binom{\lfloor\frac{n}{2}\rfloor}{2}\\=\ & 4\binom{\lfloor\frac{n}{2}\rfloor}{3} + \binom{\lfloor\frac{n}{2}\rfloor}{2}\qquad(\scriptsize{\text{by hockey stick}})\\=\ &4\cdot\frac{\frac{n}{2}\left(\frac{n}{2}-1\right)\left(\frac{n}{2}-2\right)}{3!}+\frac{\frac{n}{2}\left(\frac{n}{2}-1\right)}{2!}\\=\ &\boxed{\frac{n(n-2)(2n-5)}{24}}\end{align*}$$