The fundamental validation of the Monte Carlo method is the Law of Large Numbers: when $𝔼[X]$ does exist, meaning when $𝔼[|X|]$ is finite, then the empirical average$$\frac{1}{T}\sum_{t=1}^T X_t$$converges almost surely to $𝔼[X]$.
When the expectation $𝔼[X]$ does not exist, meaning$$\int |x|f(x)\text{d}x=+\infty$$there is no guarantee for the empirical average to converge, see e.g. the case of the Cauchy sequence, although there exist cases when it converges. As discussed in another XV question:
Counter-examples provided in Wikipedia are
- $X=\sin(Z)\exp\{Z\}/Z$ when $Z\sim\mathcal{E}xp(1)$, with $\mu=\pi/2$
- $X=2^Z(-1)^Z/z$ when $Z\sim\mathcal{G}(1/2)$, with $\mu=-\log(2)$
- $X\sim F(x)$ with $$F(x)=\mathbb{I}_{x\ge e}-\frac{e\mathbb{I}_{x\ge e}}{2x\log(x)}-\frac{e\mathbb{I}_{x\le-e}}{2x\log(-x)}+\frac{\mathbb{I}_{-e\le x\le e}}{2}$$with $\mu=0$
[in the sense that the rv's have no expectation but there exists a limit $\mu$$-$in probability if not a.s.$-$for the sample average $\bar{X}_n$].