What does it mean that an expected value does not exist? $X$ is a random variable with pdf $f$ and $g: \mathbb R \to \mathbb R$ is a measurable function. Before I start operating with $E[g(X)]$ I need to show that it exists. What does it take to show it?
1) Do I need to show that $\forall a \in \mathbb R$ and $\forall b \in \mathbb R$, $a \le b$,  $\int_{a}^{b}g(x)f(x)dx$ exists (i.e. $g(x)f(x)$ are Riemann integrable on any interval)?
2) Or I need to show that $\lim_{z \to \infty}\int_{c}^{z}g(x)f(x)dx + \lim_{z \to -\infty}\int_{z}^{c}g(x)f(x)dx=a \in \mathbb R$ (i.e. $a \ne \infty$ and $a \ne -\infty$) (because 1 is somehow automatically true)?
3) Or both?
Basically what can go so wrong that an expected value does not exists?
 A: If your random variable $X$ is $\mathbb{R}$-valued, then you need to show that the integral over the whole of $\mathbb{R}$ exists. Note that from this you will also be able to conclude that the integral over any $[a,b]$ will also exist.
A: The problem is that you can't deal with $E[g(X)]$ if this number is not defined.
So what does it take in order to define the expectation of a random variable? If $Y \geq 0$ is measurable, then we can always define $E[Y]$, though it may be infinite.
For a general $Y$ we can split it up into $Y= Y^+ - Y^-$, where $Y^+ = \max\{Y,0\}$ and $Y^- = \max\{-Y,0\}$. Since $Y^+$ and $Y^-$ are nonnegative, we can always define $E[Y^+]$ and $E[Y^-]$.
It is then natural to define $E[Y] := E[Y^+]- E[Y^-]$. This is exactly what we do, and it makes sense as long as we haven't just written $\infty-\infty$. As long as at least one of the terms is finite we are okay in defining $E[Y]$. Now to $E[g(X)]$, $Y:= g(X)$ is a random variable, and if $g \geq 0$ we don't have to worry, but it may be that both $E[Y^+]=E[Y^-] = \infty$ even if $E[|X|]<\infty$ if $g$ is nasty enough.
So how can we tell if $E[g(X)]$ exists? The easiest thing to do is to show $E[|g(X)|]<\infty$. This is equivalent to $E[g(X)^+],E[g(X)^-]<\infty$, and since $|g(X)|$ is nonnegative, we know $E[|g(X)|]$ is at least defined. Less commonly, show directly that at least one of $E[g(X)^+]$ and $E[g(X)^-]$ is finite. Here's where the fact that $X$ has a pdf comes in. If $h \geq 0$, then $E[h(X)]$ is always defined and equals $\int_{-\infty}^{\infty} h(x) f_X(x)dx$. Now we can use this with $h = |g|$ or $g^+$ or $g^-$ to actually compute $E[|g(X)|]$ or $E[g(X)^+]$ or $E[g(X)^-]$ and show at least one is finite.
