Let $(M,\mathcal{F})$ be a measurable space and $f:M\rightarrow M$ a measurable map. We say that a measure $\mu$ is invariant under $f$ if $\mu(f^{-1}(E))=\mu(E)$ for all $E\in\mathcal{F}$.
Now define the measure $$\delta_{p,k}=\frac 1 k(\delta_p+\delta_{f(p)}+\dots+\delta_{f^{k-1}(p)}),$$ where $\delta_q$ is the Dirac measure at $q\in M$, that is, $\delta_q(A)=1$ if $q\in A$ and $\delta_q(A)=0$, otherwise.
I want to show that $\delta_{p,k}$ is invariant under $f$ if, and only if, $f^k(p)=p$.
A hint suggests me to show that $\delta_{p,k}$ is invariant iff $|A\cap P|=|f^{-1}(A)\cap P|$ for any $A\in\mathcal{F}$, where $P=\{p,\dots,f^{-k+1}(p)\}$, and then show that the last condition (which i'll call $C(P)$) is equivalent to $f^k(p)=p$ by setting $A=P$. I wonder if there is a typo or an abuse of notation in the definition of $P$ because, except for $p$, its elements are sets.
I understand that $\delta_{p,k}$ is invariant iff $C(P_0)$, where $P_0=\{p,f(p),\dots,f^{k-1}(p)\}$, because $P_0$ is just the support of $\delta_{p,k}$. Following the hint but using $P_0$ instead, i get $P_0\subseteq f^{-1}(P_0)$, so $f(P_0)\subseteq P_0$ and so there exists $j\in \{0,1,\dots,k-1\}$ such that $f^k(p)=f^j(p)$, but i cannot show that $j=0$. On the other hand, if $f^k(p)=p$, then $f^{-1}(p)=f^{-1}(f^k(p))$ so $f^{k-1}(p)\in f^{-1}(p)$, this suggests me that the cardinality of $f^{-1}(A)\cap P_0$ is not decreasing (when compared to $|A\cap P_0|$) even if $p\in A$, but i cannot conclude $C(P_0)$ from it, that is, if $P_0\nsubseteq A$, then it could be the case that $|f^{-1}(A)\cap P_0|>|A\cap P_0|$. Is this going in the right direction? Any other elementary approach is welcome.
Let $\delta^j:=\delta_{f^j(p)}$, for $j=0,1,\dots,k$. If $\delta^j(f^{-1}(E))=1$, then $$ f^j(p)\in f^{-1}(E)\implies f^{j+1}(p)\in E \implies \delta^{j+1}(E)=1. $$ On the other hand, if $\delta^j(f^{-1}(E))=0$, then $$ f^j(p)\notin f^{-1}(E)\implies f^{j+1}(p)\notin E \implies \delta^{j+1}(E)=0. $$ Thus, $\delta^j(f^{-1}(E))=\delta^{j+1}(E)$. This implies that $$ \delta_{p,j}(f^{-1}(E))=\frac1 k(\delta^1(E)+\dots+\delta^k(E)). $$ Now, if $\delta_{p,j}$ is invariant, then $\delta_p(E)=\delta_{f^k(p)}(E)$ for all $E\in\mathcal{F}$ and we conclude that $f^k(p)=p$ by choosing a suitable $E$. Here we make the hypothesis that $\mathcal{F}$ separates points, but i guess this is implicit on the problem, because this is false for the trivial $\sigma$-algebra, for example. The converse is immediate.
Many thanks to @hamidkamali for the idea.