Here is an analytical proof for the general case, although I suspect better solutions exist. The $n = 2$ case is obvious, and we shall assume $n \ge 3$.
Without loss of generality, we can assume $a_1 \le a_2 \le \dots \le a_n$. First, since the function $f(x) = x^n$ is convex, we have
$$
a_2^n + \dots + a_n^n
\ge
(n - 1)
\left(
\frac{ a_2 + \dots + a_n } { n - 1 }
\right)^n,
$$
with the equality achieved at $a_2 = \dots = a_n$.
1) If $a_1 = 0$, then $a_1 \cdots a_n = 0$, we have the
\begin{align}
R
&\equiv
\frac{ \left(
a_1 + a_2 + \dots + a_n
\right)^n - n^n \, a_1 \cdots a_n
}{
a_1^n + a_2^n + \dots + a_n^n
- n \, a_1 \cdots a_n
} \\
&= \frac{ \left(
a_2 + \dots + a_n
\right)^n
}{
a_2^n + \dots + a_n^n
}
\le (n - 1)^{n - 1}.
\end{align}
2) If $a_1 > 0$, all other $a_k > 0$. The inequality makes sense only if at least two $a_k$ are different. Thus, we can assume $a_n > a_1$. Now suppose for some $m$ ($1 < m < n$), we have $a_1 \le a_m < a_n$. Consider the following infinitesimal adjustment
\begin{align}
a_1 &\rightarrow a_1 - (a_n - a_m) \, a_1 \, dt \\
a_m &\rightarrow a_m + (a_n - a_1) \, a_m \, dt \\
a_n &\rightarrow a_n - (a_m - a_1) \, a_n \, dt.
\end{align}
It leaves $a_1 + \dots + a_n$ and $a_1 \cdots a_n$ invariant, and
changes $a_1^n + \dots + a_n^n$ by
\begin{align}
d (a_1^n + \dots + a_n^n)
&=
d a_1^n + d a_m^n + d a_n^n \\
&=
n \, \left[
-(a_n - a_m) \, a_1^n
+(a_n - a_1) \, a_m^n
-(a_m - a_1) \, a_n^n
\right] \, dt \\
&=
n \, \left[
(a_n - a_m) (a_m^n - a_1^n)
-(a_m - a_1) (a_n^n - a_m^n)
\right] \, dt \\
&=
\big[
(a_m^{n-1} + a_m^{n-2} a_1 + \cdots + a_1^{n-1}) \\
&\;
-(a_m^{n-1} + a_m^{n-2} a_n + \cdots + a_n^{n-1})
\big] \,
n \, (a_n - a_m) (a_m - a_1)\, dt \\
&< 0.
\end{align}
The last expression is less than zero, because $a_1 < a_n$. This means that our adjustment always increases the target function $R$, and since it decreases $a_1$, we should set $a_1$ to the smallest possible value, which is $0$. This is the case 1).
3) Last, if no such $m$ exists, then for $m > 1$, $a_m = a_n$. Then, we can choose $m = 2$ and use the same transform, which will create some difference between $a_n$ and $a_m$, and return to case 2). This completes the proof.