I once tried to find how to quickly find the total number of squares in a bigger, $n\times n$ grid. I’m sure you’ve seen one of these puzzles, and the bigger the grid, the more embedded squares there are and the more chance you have of miscounting. So I finally came up with the answer $$ \sum^n_{k=1}k^2$$ which can be simplified to $$\frac{n(n+1)(2n+1)}{6}$$ Then later on, I wanted to try the same with a triangular (equilateral) grid, where the size $n$ corresponds to the side of the triangle.
So I eventually found a formula that has two summation terms, one inside the other, with some even/odd evaluator ($n$ is the size of a side): $$T(n)=\sum^n_{k=1}\bigg(\frac{3-(-1)^{n-k}}{2}\sum^k_{j=1}j\bigg)$$ The fraction in between the two sums is the even/odd evaluator, and determines if $n-k$ is even or odd. Now this looks long and tedious, and for large grid sizes, only a computer could do it without a chance of mistaking. Now for the important part, my question is this: Is there a way to simplify the formula in a similar way than the square grid one? Yes, I did try Wolfram Alpha, and it just gave me back the summation form of the formula.

Firstly, note that $$-(-1)^{n-k} =(-1)^{n+k+1}. \tag{1}$$ This is true because $$-(-1)^{n-k} =-(-1)^n (-1)^{-k} =-\frac{(-1)^n}{(-1)^k} \color{blue}{\cdot \frac{(-1)^k}{(-1)^k}} =-(-1)^{n+k} =(-1)^{n+k+1}.$$ Plug $(1)$ into $T(n)$ and expand: $$\begin{align} T(n) &= \sum^n_{k=1} \left( \frac{3+(-1)^{n+k+1}}{2} \cdot \frac{k^2+k}{2} \right)\\ &= \frac34\sum^n_{k=1} k^2 +\frac34\sum^n_{k=1} k +\frac{(-1)^n}{4}\sum^n_{k=1} (-1)^{k+1} k^2 +\frac{(-1)^n}{4}\sum^n_{k=1} (-1)^{k+1} k.\\ \end{align}$$
Next, use these formulae
And noting that $$(-1)^n (-1)^{n+1} = -(-1)^{2n} =-\big((-1)^n\big)^2 =-1,$$ we arrive at $$\begin{align} T(n) &=\frac14 n^3 +\frac58 n^2 +\frac38 n -\frac14 \left\lceil \frac{n}{2} \right\rceil \\&\equiv\frac{n(2n+3)(n+1)}{8} -\frac14 \left\lceil \frac{n}{2} \right\rceil.\end{align}$$