Example 8 Let $f(x)$ be a function defined on the interval $(-\infty, +\infty)$ with a period of 2. For $k \in \mathbf{Z}$, let $I_{k}$ denote the interval $(2 k-1, 2 k+1]$. It is known that when $x \in I$, $f(x)=x^{2}$.
(1) Find the analytical expression of $f(x)$ on $I_{k}$;
(2) For positive integers $k$, find the set $M_{k}=\left\{a \mid\right.$ such that the equation $f(x)=a x$ has two distinct real roots in $I_{k}$ $\}$.
This is a perplexing problem, and the root of the confusion mainly lies in the lack of understanding of symbols like $I_{k}$ and $M_{k}$. For key symbols, if they seem abstract and unfamiliar, an effective approach is to make their meanings more concrete. For example, “$I_{k}$ represents the interval $(2k-1, 2k+1]$”. That is, $I_{4}=(1,3]$, $I_{2}=(3,5]$, ..., $I_{k}=(2k-1,2k+1]$. If you have difficulty with “finding the analytical expression of $f(x)$ on $I_{t}$”, then based on the given condition “$f(x)$ is a function defined on the interval $(-\infty,+\infty)$ with a period of 2”, you can explore the analytical expression of $f(x)$ on $I_{k}$ by examining intervals such as $I_{\ldots}$, $I_{1}$, $I_{2}$, etc.

Solution:
(1) On $I_{0}=(-1,1]$, $f(x)=x^{2}$;
On $I_{1}=(1,3]$, by periodicity, it is equivalent to shifting the graph of $y=x^{2}$ to the right by 2 units, yielding
$$
f(x)=(x-2)^{2} ;
$$

On $I_{2}=(3,5]$, similarly, it is equivalent to shifting the graph of $y=x^{2}$ to the right by 4 units, yielding
$$
f(x)=(x-4)^{2} ;
$$

From the above concrete derivations, we can conclude that on $I_{k}=(2k-1,2k+1]$,
$$
f(x)=(x-2k)^{2} .
$$