The line integral over a vector field $F$ is defined as (from Wikipedia)
$$\int_C \mathbf{F}(\mathbf{r})\cdot\,d\mathbf{r} = \int_a^b \mathbf{F}(\mathbf{r}(t))\cdot\mathbf{r}'(t)\,dt \tag 1$$
notice that the expression on the left of the equality sign is just a notation for the line integral, its meaning is expressed by the integral on the right.
Then I came across the derivation of work in angular motion:
In physics, work is defined as
$\displaystyle W=\int _{s_{1}}^{s_{2}}{\vec {F}}\cdot \mathrm {d} {\vec {s}} \tag 2$
knowing that, $\displaystyle \mathrm {d} {\vec {s}}=\mathrm {d} {\vec {\theta }}\times {\vec {r}}$, we can make a substitution for $\mathrm {d} {\vec {s}}$ and obtain:
$\displaystyle W=\int _{s_{1}}^{s_{2}}{\vec {F}}\cdot \mathrm {d} {\vec {\theta }}\times {\vec {r}} \tag 3$
So far so good, in equation (3) the vector ${\vec {F}}$ hasn't changed and $\mathrm {d} {\vec {s}}$ has been replaced by an equal vector, so if we calculate it using the equation in definition (1), the value of the integral stays the same, because the derivative of ${\vec {\theta }}\times {\vec {r}}$ is equal.
Next, using the properties of triple product, we conclude that
$${\vec {F}}\cdot \mathrm {d} {\vec {\theta }}\times {\vec {r}}={\vec {r}}\times {\vec {F}}\cdot \mathrm {d} {\vec {\theta }} \tag 4$$
knowing that ${\displaystyle {\vec {\tau }}={\vec {r}}\times {\vec {F}}}$ we get:
${\displaystyle W=\int _{\theta _{1}}^{\theta _{2}}{\vec {\tau }}\cdot \mathrm {d} {\vec {\theta }}}\tag 5$
However it's not obvious to me why we're allowed to substitute (4) and (5) in equation (3).
To me, the fact that the dot products $\mathbf{F}(\mathbf{r})\cdot\,d\mathbf{r}$ and $\mathbf{G}(\mathbf{s})\cdot\,d\mathbf{s}$ are equal doesn't imply the line integrals $\int_C \mathbf{F}(\mathbf{r})\cdot\,d\mathbf{r}$ and $\int_C \mathbf{G}(\mathbf{s})\cdot\,d\mathbf{s}$ are equal as well.
Could anyone explain that, provide a theorem or a proof of it?
Now after giving it a bit more thought, the only explanation I have is - just use the definition of the line integral and the definition of the function differential. Writing the definition of line integral as a limit of the sum, we get the result:
$$\int_a^b \mathbf{F}(\mathbf{r}(t))\cdot\mathbf{r}'(t)\,dt $$ $${\displaystyle I\ =\ \lim _{\Delta t\rightarrow 0}\sum _{i=1}^{n}\mathbf {F} (\mathbf {r} (t_{i}))\cdot \mathbf {r} '(t_{i})\,\Delta t,} \tag 6$$
so from the definition of function differential $${\mathbf {r} '(t_{i})}\Delta t=\Delta\mathbf{r} \tag 7$$
This derivation is distinctly a physics derivation rather than a mathematical derivation, so you're right to be a bit skeptical. However, the derivation does work and can be made rigorous (the way this is derived is a common shorthand for the full method).
Here is one derivation (I'm omitting vector hats, so keep track of the what's a vector and what isn't):
$$\int_{\theta_1}^{\theta_2}\tau(\theta)\cdot d\theta=\int_{t_1}^{t_2}\tau(\theta(t))\cdot \theta'(t)\text{ } dt =\int_{t_1}^{t_2}({r}(t)\times{F}(s(t))\cdot \theta'(t)\text{ } dt $$ Then, by the scalar triple product formula: $$=\int_{t_1}^{t_2}F(s(t))\cdot \theta'(t)\times r(t)\text{ } dt\\=\int_{t_1}^{t_2}F(s(t))\cdot s'(t)\text{ } dt\\ =\int_{s_1}^{s_2}F(s)\cdot ds\\=W.$$
The key in the mathematical derivation is that you have to keep track of what variable each vector is parameterized with respect to. Here I have chosen to parameterize $F$ in terms of $s$ (the position vector), while $r$ and $\theta$ are in terms of time $t$. This is because we want to eventually integrate the force over a displacement.
An extra comment: This derivation does not work in general, because $ds=d\theta \times r + dr \times \theta$ in general, and that second term is only zero for a rigid body rotating with respect to a fixed origin.