Why do we treat $\mathrm{d}x$ in the indefinite integral as if $f(x)$ were multiplied by it? The first explanation I heard for the $\mathrm{d}x$ - it just shows by which variable we are integrating. Which made sense because $(F(x)+C)^\prime=f(x)$, not $f(x)\mathrm{d}x$. Now, some time later, the $\mathrm{d}x$ has become a source of confusion again. If there's $\int \frac{x}{x^2+1} \mathrm{d}x$, then why can we solve it like that: $\int \frac{1}{x^2+1} x \mathrm{d}x= \frac{1}{2}\int\frac{1}{x^2+1} 2 x \mathrm{d} x=\frac{1}{2}\int \frac{1}{x^2+1} \mathrm{d}(x^2+1)$ ? The other parts seem more or less normal but the transition from $\int\frac{x}{x^2+1} \mathrm{d}x$ to $\int \frac{1}{x^2+1} x \mathrm{d}x$ seems very strange. 
It works but why does it? If $\mathrm{d}x$ just shows by which variable we are integrating $f(x)$ then we cannot treat it as if $f(x)$ were multiplied by it. And on the other hand, if $f(x)$ IS actually multiplied by $\mathrm{d}x$ then why can we do it? I know there's simple explanation for it when we calculate the definite integral, that we break up some line or surface or volume into infinitely little pieces and then add up those infinitely little pieces to get the whole thing, so it makes sense. 
But why do we treat $\mathrm{d}x$ in the indefinite integral as if $f(x)$ were multiplied by it? Thanks.
 A: The real answer would have to do with higher levels of math than you may have covered so far (such as nonstandard analysis, differential forms, and exterior calculus$^1$) and at this point would probably be unsatisfactory to your intuitive understanding. The Leibniz notation $\frac {d}{dx}$ for the derivative is a very useful abuse of notation which allows us to think of, as you described, an "infinitesimal" part of something as if it were a real number. In standard analysis we have work out the rigors of such an intuitive idea through limits.
For your specific example, however, what you are really doing is a simple "u-substitution". You are working out the following integral:
$$\int \frac x {x^2+1} dx$$
Let $u=x^2+1$, $du=2x$; then
$$\int \frac x {x^2+1} dx=\frac 1 2 \int \frac 1 u du$$
The only difference in your equation is that the $x^2+1$ was never assigned to a temporary variable such as $u$ as it was above, and instead was written as $(x^2+1)$.
I think this is where your confusion lies. The professor wrote 
$$\int \frac x {x^2+1} dx= \int \frac 1 {x^2+1} xdx=\frac 1 2 \int \frac 1 {x^2+1} 2xdx=\frac 1 2 \int \frac 1 {x^2+1} d(x^2+1)$$
and you interpreted this as though the $2x$ had multiplied the $dx$ in order to create $d(x^2+1)$. That is not what happened, and this sort of confusion is why the abuse of notation $d(x^2+1)$ should be avoided. Instead, following the u substitution above, your professor tacitly substituted a variable $u=x^2+1$, which yields $du=2xdx$, and then did the following:
$$\frac 1 2 \int \frac 1 {x^2+1} 2xdx=\frac 1 2 \int \frac 1 u du \qquad \qquad (*)$$
However, perhaps to save space or time, they didn't explicitly assign a new variable to their substitution, so they wrote it as
$$\frac 1 2 \int \frac 1 {x^2+1} d(x^2+1)$$
Note that each $u$ in the substitution equation I did above in $(*)$ is replaced by $x^2+1$, which is what $u$ equals. Your professor just did not make this substitution explicit. In your personal work, I would avoid this practice - it is too easy to make a mistake.

$^1$ - Thanks to Zhen Lin for pointing this out.
A: As was alluded to in the comments of process91's answer there are a couple of ways of making some sense out of the $dx$.  
One way is via differential forms.  The $dx$ is then related to a vector space called the cotangent bundle.  The cotangent bundle gives you linear maps from the tangent space to $\mathbb{R}$.  Here $x$ is viewed as a function (the identity on $\mathbb{R}$) and $d$ is an operator that takes $x$ to $\frac{dx}{dx}\,dx=1\,dx=dx$.  In fact $d$ takes any function $f$ to $\frac{df}{dx}\,dx$.  This $dx$ is then the basis for a $1$-dimensional vector space.  But, then we notice that it is also the basis for a $1$-dimensional algebra over the set (actually ring) of continuous functions.  In this sense we kind of $\textit{are}$ multiplying a function $f(x)$ by $dx$.  This is when you might want to think of $dx$ as saying "integrate with respect to $x$".  In other words, integrate with respect to the identity function.  This is a more high powered way to view things.  So, I apologize if this paragraph hasn't made a ton of sense (my brain is still warming up today). 
Another way of viewing it is to introduce the notion of a measure.  Here $dx$ is viewed as giving a notion of length to each closed interval.  Again, $x$ is the identity function and we find the length of $[a,b]$ by applying the identity function to the endpoints and subtracting.  So, the length of $[a,b]$ is given by $x(b)-x(a)=b-a$.  This is when change of variables comes into play.  Suppose I have a continuous non decreasing function $f$.  Then the length of $[a,b]$ can be made to be $f(b)-f(a)$.  We can talk about integrating with respect to this new version of length.  In the definition of the Riemann integral you have limits of finite sums where function values are being multiplied by lengths of subintervals.  We just swap out our old version of length with the new one in the limits.  Now, given any continuous function we have an integral.  Converting between them is just the change of variables (or $u$-substitution) theorem: If given a continuous $f(x)$ then $df=f'(x)\, dx$.
