Legs $L_{1}, L_{2}, L_{3}, L_{4}$ of a square table each have length $n$, where $n$ is a positive integer. For how many ordered 4 -tuples $\left(k_{1}, k_{2}, k_{3}, k_{4}\right)$ of nonnegative integers can we cut a piece of length $k_{i}$ from the end of leg $L_{i}$ and still have a stable table?
(The table is stable if it can be placed so that all four of the leg ends touch the floor. Note that a cut leg of length 0 is permitted.)
Flip the table upside-down so that that the table's surface rests on the floor. Then, we see that we want the truncated legs to have endpoints $A, B, C, D$ which are coplanar (say).
Claim - This occurs if and only if $A B C D$ is a parallelogram.

Proof. Obviously $A B C D$ being a parallelogram is sufficient. Conversely, if they are coplanar, we let $D^{\prime}$ be such that $A B C D^{\prime}$ is a parallelogram. Then $D^{\prime}$ also lies in the same plane as $A B C D$, but is situated directly above $D$ (since the table was a square). This implies $D^{\prime}=D$, as needed.

In still other words, we are counting the number of solutions to
$$
\left(n-k_{1}\right)+\left(n-k_{3}\right)=\left(n-k_{2}\right)+\left(n-k_{4}\right) \Longleftrightarrow k_{1}+k_{3}=k_{2}+k_{4} .
$$

Define
$$
a_{r}=\#\{(a, b) \mid a+b=r, 0 \leq a, b \leq n\}
$$
so that the number of solutions to $k_{1}+k_{3}=k_{2}+k_{4}=r$ is just given by $a_{r}^{2}$. We now just compute
$$
\begin{aligned}
\sum_{r=0}^{2 n} a_{r}^{2} & =1^{2}+2^{2}+\cdots+n^{2}+(n+1)^{2}+n^{2}+\cdots+1^{2} \\
& =\frac{1}{3}(n+1)\left(2 n^{2}+4 n+3\right) .
\end{aligned}
$$