Since $\mathbb{E}[X]$ is defined as the integral from $0$ to infinity of $S(x)$, what do you do when $-1I have the PDF $f(x)=\frac{3}{4}(1-x^2)\mathbf 1_{-1<x<1}$ and accordingly the CDF $$F(x)=\begin{cases}0, &\phantom{-}x\le -1\\\frac{3}{4}x-\frac{1}{4}x^3+\frac12, & -1<x<1 \\1, & \phantom{-}1\le x\end{cases}$$
Since the formula for $\mathbb{E}[X]$ is the integral of $S(x)=1-F(x)$ is from $0$ to $\infty$, how do I account for the fact that $x$ is only defined from $-1$ to $1$ when I need to calculate the expectation?
 A: Assuming that with $S(x)$ you denote $1-F(x)$, where $F$ is the CDF of $X$, then this holds only for non-negative random variables, meaning random variables that take only non-negative values. That is, if $X\ge 0$ then indeed $$E[X]=\int_{0}^{+\infty}1-F(x)dx=\int_{0}^{+\infty}S(x)dx$$This is not the case here, since your random variable $X$ takes also values in $[-1,0)$ which are obviously negative. So, you need to use the general formula of the expectation, which is  $$E[X]=\int_{-\infty}^{+\infty}xf(x)dx$$ where $f$ is the PDF of $X$. This works always, for any random variable (that has a pdf $f$ of course). In your case this gives $$E[X]=\int_{-\infty}^{-1}x\cdot0dx+\int_{-1}^{1}x \cdot\frac34\left(1-x^2\right)dx+\int_{1}^{+\infty}x\cdot0dx=\frac34\int_{-1}^{1}x-x^3dx$$
A: If $X$ has probability density $f$, then by integration by parts (with clever choices of antiderivatives of $f$) we have
\begin{align}
\mathbb E[X] &= \int_{-\infty}^\infty xf(x)\ \mathsf dx\\
&=  \int_{-\infty}^0 xf(x)\ \mathsf dx + \int_0^\infty xf(x)\ \mathsf dx\\
&= xF(x)|_{-\infty}^0 - \int_{-\infty}^0 F(x)\ \mathsf dx +x(F(x)-1)|_{0}^\infty - \int_0^\infty (F(x)-1)\ \mathsf dx\\
&= \int_0^\infty (1-F(x))\ \mathsf dx -\int_{-\infty}^0 F(x)\ \mathsf dx,
\end{align}
a generalization of the so-called "Darth Vader rule" (cf. Muldowney et al.)
In this case, we have
$$F(x) = \left(\frac12+\frac34x-\frac14x^3\right)\mathsf 1_{(-1,1)}(x) + \mathsf 1_{[1,\infty)}(x),  $$
and hence
\begin{align}
\mathbb E[X] &= \int_0^\infty (1-F(x))\ \mathsf dx - \int_{-\infty}^0 F(x)\mathsf dx\\
&= \int_0^1 \left(\frac12 -\frac34 x +\frac14 x^3 \right)\ \mathsf dx - \int_{-1}^0 \left(\frac12 +\frac34 x -\frac14 x^3 \right)\ \mathsf dx\\
&= \int_0^1 \left(\frac12 -\frac34 x +\frac14 x^3 \right)\ \mathsf dx + \int_0^{-1} \left(-\frac12 -\frac34 x +\frac14 x^3 \right)\ \mathsf dx\\
&= \int_0^1 \left(\frac12 -\frac34 x +\frac14 x^3 \right)\ \mathsf dx - \int_0^1 \left(\frac12 -\frac34 u +\frac14 u^3 \right)\ \mathsf du\\
&= 0,
\end{align}
where the last equality is obtained by the change of variables $u=-x$. Note that this works because$$\mathbb E[X] = \int_{\mathbb R}\mathscr F(x)\ \mathsf dx  $$ where$$\mathscr F(x) := (-F(x))\mathsf 1_{(-\infty,0)}(x) + (1-F(x))\mathsf 1_{[0,\infty)}(x) $$ and $\mathscr F$ is an odd function (as $f$ is an even function).
A: Let us define the nonnegative random variable $Y=X+1$ for which the general integral rule you like to use works. For $Y$ we easily get $$F(y)=\begin{cases}0, &\phantom{-}y\le 0\\\frac{3}{4}(y-1)-\frac{1}{4}(y-1)^3+\frac12, & 0<y<2 \\1, & \phantom{-}2\le y\end{cases}$$
Now we may observe that $$EY=\int_0^2(1-F(y))dy=\int_0^1(1-\frac{3}{4}(y-1)+\frac{1}{4}(y-1)^3-\frac12)dy=1.$$
Therefore with $EY=EX+1$ we obtain $EX=0$.
