Depending on interpretation, there may be an assumption missing from Exercise 6.1.4(a) in Liviu I. Nicolaescu's Invitation to Morse Theory:
Suppose $f : \mathbb{R} → \mathbb{R}$ is a proper Morse function, i.e., $f^{−1}(\text{compact}) = \text{compact}$. Prove that the number of critical points of $f$ is even if $\lim_{x\to \infty} f(x)f(−x) = −\infty$, and it is odd if $\lim_{x \to \infty}f(x)f(−x) = \infty$.
This motivates my question: Can a proper Morse function $\mathbb{R}\to\mathbb{R}$ have infinitely many critical points? I believe I have such an example below, but I would like confirmation.
Example. The function $f(x)=x/2 + \sin(x)$ has (infinitely many) critical points $x=\pm \frac{2\pi}{3}+2n\pi$. This clearly satisfies $\lim_{x \to \infty} f(x)f(-x)=-\infty$, and we also see that $f$ is Morse: $$f''(\pm\frac{2\pi}{3} + 2n\pi)=-\sin(\pm\frac{2\pi}{3}+2n\pi)=\mp\frac{\sqrt{3}}{2}\neq 0.$$ As for $f$ being proper, continuity and Heine-Borel leave us needing to show that $$f^{-1}(\text{bounded})=\text{bounded}.$$ To this end, observe that $f^{-1}([-a,a])\subset [-2a-2,2a+2]$: It suffices to show that $|x| \leq 2|f(x)| +2$, which is trivial if $|x|\leq 2$. When $|x|\geq 2$, we have $|x| \leq 2|f(x)|+2$ because $$|f(x)|=\left|\frac{x}{2} + \sin(x)\right|\geq\left|\frac{|x|}{2}-|\sin(x)|\right| = \frac{|x|}{2}-|\sin(x)|\geq \frac{|x|}{2}-1.$$
Remark. In the case of finitely many critical points, I think the idea is to recognize that a Morse function $f$ has $f''(x) \neq 0$ whenever $f'(x)=0$, so the critical points occur at strict local minima and maxima. Then there has to be a certain "cancellation" of these extrema depending on whether $\lim_{x\to \infty}f(x)f(-x)$ is positive or negative infinity.