*ergodic*if whenever $A\subset X$ satisfies $T^{-1}A=A$ we have $\mu(A)=0$ or $\mu(A^c)=0$. To aid intuition, it is useful to keep in mind the ergodic theorem, which roughly states that ergodicity equals equidistribution.

Following a discussion today, I'm concerned here with the ergodicity of $T^n$ for $n\in\mathbf{N}$. This is an entertaining topic, and I thank Rudi Mrazovic for bringing it to my attention. Here's an amusing example: While $T$ being ergodic does not generally imply that $T^2$ is ergodic, $T^2$ being ergodic does imply that $T^4$ is ergodic.

Let's start with a quite simple observation.

Lemma: If $n\in\mathbf{N}$ and $T^n$ is ergodic then $T$ is ergodic.Proof: Suppose $T^{-1}A=A$. Then $T^{-n}A=A$, so $\mu(A)=0$ or $\mu(A^c)=0$. $\square$

What is the picture of $T$ being ergodic and $T^n$ not being ergodic? Certainly one picture to imagine is a partition $X = E\cup T^{-1}E\cup\cdots\cup T^{-(d-1)}E$ with $1<d\mid n$ and $T^{-d}E=E$, or in other words a factor $X\to \mathbf{Z}/d\mathbf{Z}$. Possibly surprisingly, this is the whole story.

Theorem: If $T$ is ergodic and $T^n$ is not ergodic then for some divisor $d>1$ of $n$ there exists a partition of $X$ as $E\cup T^{-1}E\cup\cdots\cup T^{-(d-1)}E \cup N$ where $T^{-d}E=E$ and $\mu(N)=0$.Proof: Since $T^n$ is not ergodic there exists a set $A$ with $T^{-n}A=A$ and $\mu(A)>0$ and $\mu(A^c)>0$. For any subset $S\subset \mathbf{Z}/n\mathbf{Z}$ let $X_S$ consist of those $x\in X$ such that

$$\{j\in\mathbf{Z}/n\mathbf{Z} : T^j x \in A\} = t + S$$

for some $t\in\mathbf{Z}/n\mathbf{Z}$. (Note that because $x\in A$ iff $T^n x\in A$, the sentence "$T^j x \in A$" makes sense for $j\in \mathbf{Z}/n\mathbf{Z}$.) Note that $T^{-1}X_S = X_S$, so $\mu(X_S)=0$ or $\mu(X_S^c)=0$. Since $X = \bigcup_S X_S$, we must have $\mu(X_S^c)=0$ for some $S$.

Let $d$ be the smallest positive period of $S$. Note that $d=1$ iff $S=\emptyset$, contradicting $\mu(A)>0$, or $S=\mathbf{Z}/n\mathbf{Z}$, contradicting $\mu(A^c)>0$, so $d>1$. Let

$$E = \bigcap_{j\in S} T^{-j} A.$$

(Again note that $T^{-j}A$ makes sense for $j\in\mathbf{Z}/n\mathbf{Z}$.) Then $\mu(T^{-i}E \cap T^{-j} E) = 0$ unless $-i+S = -j+S$, i.e., iff $i-j$ is divisible by $d$, in which case $T^{-i}E=T^{-j}E$. Thus we have the desired partition

$$X_S = E \cup T^{-1}E \cup \cdots \cup T^{-(d-1)}E.\square$$

Note as a corollary that "only the primes matter" insofar as far as which $n\in N$ make $T^n$ ergodic: if $n>1$ and $T^n$ is not ergodic then for some prime $p|n$, $T^p$ is not ergodic. Combining this with the initial lemma, which shows that if $T^n$ is ergodic then $T^p$ is ergodic for every $p|n$, we have thus proved one half of the following theorem.

Theorem: Given a set $S\subset\mathbf{N}$, there exists a measure-preserving system $(X,\Sigma,\mu,T)$ such that $S = \{n\in\mathbf{N} : T^n \text{ is ergodic}\}$ if and only if $S$ is empty or the set of $n\in\mathbf{N}$ not divisible by any $p\in\mathcal{P}$, for some set of primes $\mathcal{P}$.It remains only to construct a measure-preserving system for a given set $\mathcal{P}$ of primes. For $\mathcal{P}$ finite this can be achieved even with finite spaces. In general it suffices to look at $\prod_{p\in\mathcal{P}} \mathbf{Z}/p\mathbf{Z}$.