12 (14 points) Given the function $f(x)=-2 x+4$, let
$$
S_{n}=f\left(\frac{1}{n}\right)+f\left(\frac{2}{n}\right)+\cdots+f\left(\frac{n-1}{n}\right)+f(1)\left(n \in \mathbf{N}^{*}\right) \text {, }
$$

If the inequality $\frac{a^{n}}{S_{n}}<\frac{a^{n+1}}{S_{n+1}}$ always holds, find the range of real number $a$.
$(12) S_{n}=-2\left(\frac{1}{n}+\frac{2}{n}+\cdots+\frac{n-1}{n}+1\right)+4 n=3 n-1$.
Given that $\frac{a^{n}}{S_{n}}0$ always holds, then $a^{n}0$, which is a contradiction, so $a0$. When $a0$, since $a^{n}>0$, from equation (1) we get
$$
a>\frac{3 n+2}{3 n-1}=1+\frac{3}{3 n-1} \text {. }
$$

Since $\frac{3}{3 n-1}$ decreases as $n$ increases, when $n=1$, $1+\frac{3}{3 n-1}$ reaches its maximum value $\frac{5}{2}$, thus $a>\frac{5}{2}$. Therefore, $a \in\left(\frac{5}{2},+\infty\right)$.
In conclusion, the range of $a$ is $\left(\frac{5}{2},+\infty\right)$.