Let $f(x)=\sin(x)x^2$. If you were to do integration by parts you would get:
$$\int \sin(x)x^2dx=\int\sin(x)dx\times x^2-\iint\sin(x)dx\times\frac{d}{dx}x^2dx$$
$$\int \sin(x)x^2dx=-\cos(x)x^2-\int-2\cos(x)xdx$$
$$\int\sin(x)x^2dx=-\cos(x)x^2+2(\int\cos(x)dx\times x-\iint\cos(x)dx\times\frac{d}{dx}xdx)$$
$$\int\sin(x)x^2dx=-\cos(x)x^2+2(\sin(x)x+\cos(x))+C$$
The part that I don't understand is why do we add the constant only at the end? For example, in row #$1$ you need to find the $\int \sin(x)dx$. We take it to be $-\cos(x)$ but in reality, it is $-\cos(x)+C_1$. If you were to compute this with $\int \sin(x)dx=-\cos(x)+C_1$, you would get the wrong result because $\int \sin(x)dx$ needs to be integrated again, and $C_1$ would turn in $x$, therefore you would get the wrong result. How do we know that $C_1=0$? I get that the solution will be correct that way, but why?