The density function of $X$ is equal to $\frac{1}{2}$ on the interval $[-1,1]$, and $0$ elsewhere.
The expectation of $X^{-1}$ is, by a standard formula, equal to $\int_{-1}^1 \left(\frac{1}{x}\right)\left(\frac{1}{2}\right)dx,$ if this integral exists.
Note that $\frac{1}{2x}$ "blows up" near $0$. For such functions, the usual definition of Riemann integral does not work. Our integral is an example of what's called an improper integral in English-language calculus courses.
For a badly behaved function like this one, we break up the interval of integration into two parts at the bad point, and look at the integral from $-1$ to $0$, and the integral from $0$ to $1$, separately. If both these integrals are fine, we say that the improper integral exists, or converges. If one or both of the integrals fails to exist, we say that the improper integral does not exist.
Now we examine the integral $\int_0^1\frac{dx}{2x}. \qquad(\ast)$ To determine whether or not this integral exists, we let $I_h=\int_h^1 \frac{dx}{2x}.$ If the limit of $I_h$, as $h$ approaches $0$ through positive values, exists, then we say that the improper integral $(\ast)$ exists (converges). If the limit does not exist, we say that the improper integral $(\ast)$ does not exist (diverges).
Finally, we can calculate! An antiderivative of $\frac{1}{2x}$ is $\frac{1}{2}\ln x$. It follows that $I_h=\frac{1}{2}(\ln 1-\ln h)=-\frac{1}{2}\ln h.$ Finally, let $h$ approach $0$ through positive values, so that the interval $[h,1]$ looks more and more like $[0,1]$. As $h$ approaches $0$, $\ln h$ becomes very large negative, and therefore the limit of $I_h$ as $h$ approaches $0$ from the right does not exist.
Much more informally, the area under the curve $y=\frac{1}{2x}$, from $x=0$ to $x=1$, is infinite.