We are given a function $f:X\longrightarrow \mathbb{R}$ and an arbitrary measure space $(X,\mathfrak{A},\mu)$ and the assumption that $$\int_X f d\mu<\infty.$$ We need to show that $$\int_X f d\mu = \int_\mathbb{R} \left(\mu f^{-1}(t,\infty)-\mu f^{-1}(-\infty,-t) \right) d\lambda$$ where $\lambda$ is the Lebesgue measure (on $\mathbb{R}$).
What I think is that we can start off by observing that $f$ is finite almost everywhere and excising such a set where $f$ is not finite, we can work with a bounded function $f$. This allows us to use approximate $f$ with a simple function as close as we like but that's all I can do. I don't even know how to show that this holds for a simple function.
Start of by breaking $f$ into $f_+ - f_-$, where $f_+$ is strictly nonnegative, $f_-$ is strictly non-positive, and at least 1 is always zero. That is, $f_+(x) = \max(f(x), 0)$ and $f_-(x) = \min(f(x), 0)$.
Then by definition, $\int f d\mu = \int f_+ d\mu - \int f_- d\mu$.
I assume the right-side integral is in fact supposed to be taken over $\mathbb{R}_+$. Otherwise, the theorem is wrong.
Then we have $\int \mu(f^{-1}((t, \infty)) d \lambda = \int \mu(f_+^{-1}(t, \infty)) d\lambda$ and similarly, we have $\int \mu(f^{-1}(-\infty, -t)) d \lambda = \int \mu(f_-^{-1}(t, \infty)) d\lambda$. Consequently, it suffices to show that for all $f$ with nonnegative range, we have
$\int f d\mu = \int \mu(f^{-1}((t, \infty)) d\lambda$
where the integral is taken over nonnegative $t$.
This statement is clearly true for simple functions. For consider a partition $T_1, ..., T_n$ of measurable sets which $f$ maps to $r_1, ..., r_n$ respectively, with $r_1 > r_2 > ... > r_n$ (and WLOG we can set $r_n$ to be 0).
$\int f d\mu = \sum \mu(T_i) r_i$
And $\mu(f^{-1}((t, \infty))$ is a simple function sending $[r_1, \infty)$ to 0, $[r_2, r_1)$ to $\chi(T_1)$, and in general $[r_{i + 1}, r_i)$ to $\sum_{j = 1}^i \chi(T_j)$. Then
\begin{equation} \begin{split} \sum\limits_{i = 1}^{n - 1} \mu(T_i) r_i &= \sum\limits_{i = 1}^{n - 1} \sum\limits_{j = i}^{n - 1} \mu(T_i) (r_j - r_{j + 1}) \\ &= \sum\limits_{j = 1}^{n - 1} \sum\limits_{i = 1}^{j} \mu(T_i) (r_j - r_{j + 1}) \\ &= \sum\limits_{j = 1}^{n - 1} (r_j - r_{j + 1}) \sum\limits_{i = 1}^{j} \mu(T_i) \end{split} \end{equation}
So the two integrals are equal whenever $f$ is a simple function. Conversely, it can be shown that whenever $t \mapsto \mu(f^{-1}((t, \infty))$ is a simple function, $f$ is a.e. equivalent to a simple function.
This is enough to prove the identity.