I'm trying to find a formula to find the pdf from the distribution's moments.
I did the following:
$$ f_X(x) = \int_{0}^{\infty} M_X(t)\text{e}^{-tx} dt = \int_{0}^{\infty} \sum_{k=0}^{\infty} \frac{t^k}{k!} E \left[ X^k\right]\text{e}^{-tx} dt = \sum_{k=0}^{\infty} E \left[ X^k\right] \int_{0}^{\infty}\frac{t^k}{k!} \text{e}^{-tx} dt \nonumber\\ \therefore f_X(x) = \sum_{k=0}^{\infty} \frac{1}{x^{k+1}} E \left[ X^k\right] $$
But this doesn't seem quite right. If I substitute the raw moments from the Rayleigh distribution:
$$ E \left[ X^k\right] = \sigma^k 2^{\frac{k}{2}} \Gamma\left(1+\frac{k}{2}\right) \nonumber \\$$
I do not get the Rayleigh distribution.
You've attempted to identify $f_X$ with the Laplace transform of $M_X$, which would imply $M_X$ is the inverse Laplace transform of $f_X$, whereas by definition it isn't. Explicitly, it would be wrong to claim $M_X(t)=\frac{1}{2\pi i}\lim_{T\to\infty}\int_{\gamma-iT}^{\gamma+iT}e^{tx}f_X(x)dx$, because actually $M_X(t)=\int_{-\infty}^\infty e^{tx}f_X(x)dx$.