Question about Spivak's proof of how to use u-substitution when the derivative of the inner function does not appear in the integral Spivak (3rd edition) proposes solving the integral $$\int \frac{1+e^x}{1-e^x} dx$$ by letting $u=e^x$, $x=\ln(u)$, and $dx=\frac{1}{u}du$. This results in the integral $$\int \frac{1+u}{1-u}\frac{1}{u}du\\=\int \frac{2}{1-u}+\frac{1}{u}du=-2\ln(1-u)+\ln(u)=-2\ln(1-e^x)+x$$
From this example, Spivak argues that a similar method will work on any integral of the form $\int f(g(x))dx$ whenever $g(x)$ is invertible in the appropriate interval. Because this method is not a simple application of the substitution theorem, Spivak provides the following justification for his claim.
Consider continuous $f$ and $g$ where $g$ is invertible on the appropriate interval. Applying the above  method to the arbitrary case, we let $u=g(x)$, $x=g^{−1}(u)$, and $dx=(g^{−1})′(u)du$. Thus, we need to show that $$∫f(g(x))dx=∫f(u)(g^{−1})′(u)du$$ To prove this equality Spivak uses a more typical substitution $u=g(x)$, $du=g′(x)dx$ and applies it by noting that $$∫f(g(x))dx=∫f(g(x))g′(x)\frac{1}{g′(x)}dx$$ Presumably using the substitution theorem, which roughly states that $∫f(g(x))g'(x)dx=∫f(u)du$, Spivak asserts that  $$∫f(g(x))g′(x)\frac{1}{g′(x)}dx=∫f(u)\frac{1}{g′(g^{−1}(u))}du$$ Then, because $(g^{-1})'(u)=\frac{1}{g'(g^{-1}(u))}$ Spivak concludes $$∫f(u)\frac{1}{g′(g^{−1}(u))}du=∫f(u)(g^{−1})′(u)du$$
I lose track of the argument when Spivak argues that $$∫f(g(x))g′(x)\frac{1}{g′(x)}dx=∫f(u)\frac{1}{g′(g^{−1}(u))}du$$ In the original example, it was clear to me how we could apply the substitution theorem to make this equality true because $\frac{1}{g'(x)}$ was in fact a function of $g(x)$ as $g'(x)=g(x)$. But this is not necessarily true in all cases, or so it seems. How do we know that $f(g(x))\frac{1}{g'x}$ can be written in the form $h(g(x))$ for some continuous function $h$? To sum up, my main questions is, how do we use the substitution theorem to justify the equality $$∫f(g(x))g′(x)\frac{1}{g′(x)}dx=∫f(u)\frac{1}{g′(g^{−1}(u))}du$$
 A: Note that
\begin{align}
\int f(g(x))\cdot g'(x) \dfrac{1}{g'(x)}\ dx
&= \int \underbrace{f(g(x))\cdot\dfrac{1}{(g' \circ g^{-1})(g(x))}}_{h(g(x))}\ \underbrace{g'(x)\ dx}_{du} \\
\end{align}
where I defined $h(t):= f(t) \cdot \dfrac{1}{(g' \circ g^{-1})(t)}$. So, now of course, you can apply the substitution rule in the first form Spivak presented, simply by putting $u = g(x)$ and $du = g'(x)\ dx$.

Anyway, let me just add a few comments about how (a few years back), after reading Spivak's chapter, I really convinced myself that the substitution rule is actually true as a consequence of the chain rule, rather than some symbolic manipulation (I mean of course I knew it was true, but not how the computations aligned with the formalism).
I would recommend reading this previous answer of mine, where I pretty much (re)explain what I understood from reading this section in Spivak. Anyway, the gist is the following. Given any continuous $f$, when we write down the symbol $\int f(x)\, dx$, what we really mean is a differentiable function (or if you wish an equivalence class of differentiable functions), $F$, such that $F' = f$. So, I shall refer to this primitive function $F$ (or rather its equivalence class) by the symbol $\text{prim}(f)$. Then, the common subsitution rule
\begin{align}
\int f(g(x)) \cdot g'(x) \, dx &= \int f(u)\, du \quad \text{where $u = g(x)$}
\end{align}
can be written (I'd say more correctly from a technical perspective) as
\begin{align}
\text{prim}((f \circ g) \cdot g') &= \text{prim}(f) \circ g.
\end{align}
(by the way $\text{prim}(f) \circ g$ of course means $[\text{prim}(f)] \circ g$).
All this equation is saying is that if you differentiate both sides, you get the same function, namely $(f \circ g) \cdot g'$. On the LHS, that is trivially true, by definition of $\text{prim}(\cdot)$, while on the RHS, it is because of the chain rule. Now, if $g$ is invertible, we can "solve" this equation to get
\begin{align}
\text{prim}(f) &= \text{prim}((f \circ g) \cdot g') \circ g^{-1}
\end{align}
This equation is true for EVERY continuous $f$, and every continuously differentiable $g$, which is invertible. Just for the sake of avoiding confusion later on, I'll write this as
\begin{align}
\text{prim}(\phi) &= \text{prim}((\phi \circ \psi) \cdot \psi') \circ \psi^{-1}
\end{align}
Now, the equation you're looking for is obtained by plugging in $\phi = f \circ g$ and $\psi = g^{-1}$. Then, this immediately reduces to
\begin{align}
\text{prim}(f \circ g) &= \text{prim}\left(f \cdot (g^{-1})'\right) \circ g \\
&= \text{prim}\left(f \cdot \dfrac{1}{g' \circ g^{-1}} \right) \circ g,
\end{align}
where in the last line, I used the inverse function theorem for the formula of derivative of inverses. Of course, if you write this out in the classical notation, it says that if we put $u = g(x)$, then
\begin{align}
\int f(g(x))\, dx &= \int f(u) \cdot (g^{-1})'(u)\, du \\
&= \int f(u) \cdot \dfrac{1}{g'(g^{-1}(u))}\, du
\end{align}
In the previous answer of mine, I explain in slightly more detail, how to translate back and forth between the two notations.
Also, one final remark which I feel compelled to add: no one ever uses this $\text{prim}(\cdot)$ notation, and for good reason, because in actual hands-on computations, it doesn't serve us too well, so of course, you should get comfortable with all the tricks of integration being applied in the classical notation as well. The only thing which this notation offers is a temporary way of writing things, in order to clarify for oneself what exactly is going on when applying the substitution rule (as I'm sure several people have atleast once thought about why it's true considering we're taught derivatives are not fractions, but yet in this one circumstance, we treat it as a fraction).
A: Believe it or not,
$$
\int f(g(x)) \, dx
$$
is still of the correct form to admit substitution, provided that $g$ is invertible. To begin with, consider what we are aiming for: we know that any integral of the form
$$
\int \phi'(\mu(x))\mu'(x) \, dx
$$
is equal to $\phi(\mu(x))+C$, and making the substitution $u=\mu(x)$ works out just the same (hence why integration by substitution is valid in the first place). This means that if $f(g(x))$ can be written as $\phi'(\mu(x))\mu'(x)$ for some functions $\phi'$ and $\mu$, then substitution is applicable. First, rewrite the integral as
$$
\int \frac{f(g(x))}{g'(x)}g'(x) \, dx
$$
Now, the derivative of the inner function $g$ appears elsewhere, which is what we wanted. From here, it is simply a matter of rearrangement:
\begin{align}
\int \frac{f(g(x))}{g'(x)}g'(x) \, dx &= \int \frac{f(g(x))}{g'(g^{-1}(g(x)))}g'(x) \, dx \\
&= \int \phi'(g(x))g'(x) \, dx
\end{align}
where $\phi'$ is the function defined by
$$
\phi'(x) = \frac{f(x)}{g'(g^{-1}(x))} \, .
$$
(It should now be clear why it is necessary that $g$ is invertible.) We find that the integral is equal to
$$
\int f(g(x)) \, dx = \int \phi'(g(x))g'(x) \, dx = \phi(g(x)) + C
$$
Compare this method with how we usually make substitutions. When we set $u=g(x)$ so that $x = g^{-1}(u)$ and $dx = (g^{-1})'(u) \, du$, it may seem that we are doing something completely different to the method shown above. However, if we realise that
$$
(g^{-1})'(u) = \frac{1}{g'(g^{-1}(u))}
$$
then it becomes clear that the two methods are virtually the same:
\begin{align}
\int f(g(x)) \, dx &= \int f(u) (g^{-1})'(u) \, du \\
&= \int \frac{f(u)}{(g'(g^{-1}(u))} \, du \\
&= \int \phi'(u) \, du \\
&= \phi(u) + C \\
&= \phi(g(x)) + C \, .
\end{align}
