This assumes we already know it that the formula is for an AP*.
We should only be concerned with the case where both $(a_1+a_n)$ and $n$ are odd, otherwise clearly $S_n$ will be an integer.
For $(a_1+a_n)$ to be odd, either $a_1$ is odd and $a_n$ is even, or the other way round. In both cases, this requires the number of terme $n$ to be even. This is shown below.
Let $d$ be the common difference of the AP. Consider the following:
- If $a_1$ is odd and $d$ is odd, the parity of the AP is $OEOEO\cdots$, i.e.
$a_n$ is even only for even $n$.
- If $a_1$ is odd and $d$ is even, the parity of the AP is $OOOOO\cdots$, i.e. $a_n$ is odd, so not a possibility, as both $a_1$ and $a_n$ are odd.
- If $a_1$ is even and $d$ is odd, the parity of the AP is $EOEOE\cdots$, i.e. $a_n$ is odd only for even $n$.
- If $a_1$ is even and $d$ is even, the parity of the AP is $EEEEE\cdots $, i.e. not a possibility.
Hence it is not possible for both $(a_1+a_n)$ and $n$ to be odd at the same time, so at least one of them must be even.
As such, their product is even and $S_n$ is an integer. $\blacksquare$.
*If we did not know that
$$S_n=(a_1+a_n)\cdot \frac n2$$
refers to an AP in the first, then we would have to prove that first.
Here's one approach of doing that.
$$\begin{align}
&2S_{n-1}&&=(n-1)\left(a_1+a_{n-1}\right)\\
&2S_{n}&&=\qquad n\left(a_1+\ a_{n}\; \right)\\
&2S_{n+1}&&=(n+1)\left(a_1+a_{n+1}\right)\\\\
&2(S_{n+1}-S_n)=2a_{n+1}&&=a_1+(n+1)a_{n+1}-na_n\\
& \qquad\qquad\qquad 0 &&=a_1+(n-1)a_{n+1}-na_n\tag {1}\\\\
&2(S_{n}-S_{n-1})=2a_{n}&&=a_1+na_{n}-(n-1)a_{n-1}\\
& \qquad\qquad \qquad 0 &&=a_1+(n-2)a_{n+1}-(n-1)a_n\tag {2}\\\\
(1)-(2):\qquad
&\qquad\qquad\qquad 0&&=0+(n-1)a_{n+1}-(2n-2)a_n+(n-1)a_{n-1}\\
&\qquad\qquad\qquad 0&&=0+a_{n+1}-2a_n+a_{n-1}\\
&\qquad\qquad\qquad 2a_n&&=a_{n+1}+a_{n-1}\\
\end{align}$$
Hence the series is an AP. $\blacksquare$