This can be made rigorous, but this is one of the instances in which the notation is chosen so that the calculations get intuitive.
$ds^2$ is just a bookkeeping notation to express the metric tensor, which you can think of as a non-positive definite inner product between vectors defined on spacetime. Now the actual calculation Carroll is doing is computing the inner product between the four-velocity (the four-dimensional analog of velocity) with itself. The four-velocity has components
$$u^\mu = \left(\frac{dt}{d\lambda},\frac{dr}{d\lambda},\frac{d\theta}{d\lambda},\frac{d\phi}{d\lambda}\right)$$
for some parameter $\lambda$ labeling the curve to which the four-velocity is parallel. From Carroll's expression, I can tell he is assuming that $\frac{d\theta}{d\lambda} = \frac{d\phi}{d\lambda} = 0$. Calculating the inner product of $u^\mu$ with itself then tells you that
$$0 = - \left( 1 - \frac{2GM}{r} \right) \left(\frac{dt}{d\lambda}\right)^{2} + \left( 1 - \frac{2GM}{r} \right)^{-1} \left(\frac{dr}{d\lambda}\right)^{2},$$
where he had previously assumed that the inner product of $u^\mu$ with itself was zero. Now, both $t$ and $r$ can be understood as functions of a single variable $\lambda$. You can then use the chain rule in the expression above to get to Carroll's final expression.
Of course, when doing physics we are not interested in all of these intermediate steps: they only slow you down. So we work with this notation that allows you to do all of these procedures way more quickly, so the notation ends up doing the hard work for you.
I want to point out that this is good notation. You make the notation do the hard work for you. If you want to write rigorous proof, this notation might be bad, but when we use it we do not want to write rigorous proofs: we want to do calculations. Hence, we are just using Axiom 7 (Suggestiveness II) of this beautiful answer by Terry Tao. The notation already implements many important results that we use all the time so we can make short cuts and get to the result faster and with less work. This is the same basic idea behind Dirac notation in quantum mechanics.
Each notation has its purpose. If you use it for the wrong purpose, of course it will be bad. But using it for its intended purpose can simplify many calculations.