Let $\mathbb{F}_q$ denote a field with $q=p^n$ elements, where $p$ is prime. Consider the polynomial $f=x^{p^{n-1}}+\ldots+x^p+x$ and the sets $$ \begin{align*} S&=\{a^p-a:a\in\mathbb{F}_q\},\\ T&=\{b\in\mathbb{F}_q:f(b)=0\}. \end{align*} $$ Show that $S=T$.
My ideas: I can show $S\subset T$ as follows. Let $x\in S$. Then $x=a^p-a$ for some $a\in\mathbb{F}_q$. We have $$ \begin{align*} f(x)&=(a^p-a)^{p^{n-1}}+(a^p-a)^{p^{n-2}}+\ldots+(a^p-a)^p-(a^p-a)\\ &=a^{p^n}+a^{p^{n-1}}+\ldots+a^{p^2}+a^p-a^{p^{n-1}}-a^{p^{n-2}}-\ldots-a^p-a\\ &=a^{p^n}-a\\ &=a-a\\ &=0. \end{align*} $$ Thus $x\in T$. However, I have no idea how to show $T\subset S$. Any advice? Maybe we can make use of the fact that $a\mapsto a^p-a$ is $\mathbb{F}_p$-linear?
You have proved $S\subseteq T$. As $f$ has degree $p^{n-1}$ it has at most $p^{n-1}$ zeroes: $|T|\le p^{n-1}$.
The polynomial $g(x)=x^p-x$ has degree $p$. For $a\in\Bbb F_q$, $g(x)=a$ has at most $p$ solutions. Therefore the image $S=\{g(b):b\in \Bbb F_q\}$ has $|S|\ge q/p=p^{n-1}$. Therefore $$p^{n-1}\le|S|\le|T|\le p^{n-1}.$$ Consequently $|S|=|T|$, and so $S=T$.
Note that $f$ represents the trace map from $\Bbb F_q$ to $\Bbb F_p$.