What is the derivative of the expected value of a continuous random variable? Say we have a random variable $X$, with density function $f(x)$, and moment generating function $M(t) = E[e^{tX}]$, and we take the derivative of $M(t)$

$$\frac{d}{dt} M(t) = \frac{d}{dt}E\left[e^{tX} \right] = E\left[\frac{d}{dt}e^{tX} \right]$$

I can see how this works in the discrete case, as we are bringing the derivative inside a summation and the derivative of sums is the sum of the derivatives. But why are we allowed to bring the derivative inside the integral in the continuous case?

$$\frac{d}{dt}\int_X e^{tX}f(x)dx = \int_X \frac{d}{dt}[e^{tX}f(x)]dx$$?
I believe what you need is a direct application of Leibniz's Rule.  It requires continuity on the integrand and its partial derivative, so I believe that distributions can be constructed in which this does not hold (though perhaps such cases can be handled by the measure-theoretic formulation).
For $X$ a cont. random variable, in any case when $E |X| &lt; \infty$, your equation holds.

The following proof for characteristic functions can be transferred to the moment gen. function.