Let f be infinitely differentiable function on $\mathbb{R}$ and let $x_0 \in \mathbb{R}$.
We can write the function $f(x)$ as
$$f(x)=f(x_0)+\int_{x_0}^x{f'(t)dt}$$ or $$f(x)=f(x_0)-\int_{x_0}^x{f'(t)d(x-t)}$$
With partial integration we get
$$f(x)=f(x_0)+f'(x_0)(x-x_0)-\int_{x_0}^{x}{f''(t)\cdot t \ dt}$$
And with induction it can be proved that
$$f(x)=f(x_0)+\frac{f'(x_0)}{1!}(x-x_0)+\cdots +\frac{f^{(n)}(x_0)}{n!}(x-x_0)^n+R_{n+1}$$ where $$R_{n+1}=-\frac{1}{n!}\cdot \int_{x_0}^x{f^{(n+1)}(t)\cdot t^ndt}$$
The first line is pretty clear to me. However I fail to see how the second equality is equivalent to the first. This $d(x-t)$ confuses me a lot. I also know that we choose $f'(t)=u$ so $f''(t)dt=du$ however not sure what we are choosing as $dv$. Any help is appreciated.
There are some errors in the second and third equations, so it is understandable how you are confused.
Here is what is going on starting from the first equation $$f(x)=f(x_0)+\int_{x_0}^x{f'(t)dt}.$$ We integrate by parts using $u=f'(t)$ and $v=x-t$, so $dv=-dt$. We thus have \begin{align*} \int_{x_0}^x{f'(t)dt} &=-\int_{x_0}^x f'(t)(-dt) \\ &=-(f'(t)(x-t))\Big|_{x_0}^x+\int_{x_0}^xf''(t)(x-t)dt \\ &=f'(x_0)(x-x_0)+\int_{x_0}^xf''(t)(x-t)dt. \end{align*} Plugging this back into the first equation we have $$f(x)=f(x_0)+f'(x_0)(x-x_0)+\int_{x_0}^xf''(x)(x-t)dt.$$ This is almost what the (erroneous) third equation says, but with $x-t$ instead of $-t$ in the integrand.
(Looking back on this, you can see the second equation as an attempt to rewrite the integral in the form $\int udv$ with $u=f'(t)$ and $v=x-t$. However, it is incorrect, since if you rewrite the integral with $d(x-t)$, you must also change the bounds of integration to be in terms of $x-t$ instead of in terms of $t$.)