Q:

How to find $u(x,y)$ given $\frac{\partial u}{\partial x}$?

In the third line from the bottom, they find $u$, but I don't understand how they did it, could someone explain in more detail?

A:

Partially differentiate the third line from the bottom ($u=\dots$) w.r.t to $x$ and you see that you get the line above it. 
The constant $c_1$ is just the usual integration constant (that always disappears when you take the derivative) and $f(y)$, which is some function of $y$ (but not $x$), disappears because it doesn't depend explicitly on $x$, so to the eyes of the partial derivative, it too looks like a constant.
Finally, you have to know that $u=u(x,y)$ and no other variables. If, for instance, $u=u(x,y,z)$, then we would have to add yet another term $u=\dots+f(z)$.
Edit: As OP points out, $u=ux^2+\dots\;$ should indeed be $u=yx^2+\dots$ 

