Given an exact differential; How do you find the function that satisfies the differential? Suppose we have a differential: $$\mathrm{d}u=y\mathrm{d}x + (x+2y)\mathrm{d}y\tag{1}$$ and a general differential: $$\mathrm{d}u=\underbrace{P(x,y)}_{\color{#F80}{\dfrac{\partial u}{\partial x}}}\mathrm{d}x +\underbrace{Q(x,y)}_{\color{#A0F}{\dfrac{\partial u}{\partial y}}}\mathrm{d}y\tag{2}$$ where $u$, $P$ and $Q$ are unknown functions of $x$ and $y$; the partial derivatives below the underbraces show that $(2)$ is also the total derivative. Comparing $(1)$ with $(2)$ we have that $P=y$ and $Q=x+2y$. 
$(1)$ is an exact differential since $$\frac{\partial P}{\partial y}=1=\frac{\partial Q}{\partial x}=1$$
In my notes it says in order to find $u$ we integrate and $\color{red}{\fbox{match}}$ such that $$P=\color{#F80}{\frac{\partial u}{\partial x}}=y$$
$$\begin{align}\implies \color{#180}{u = xy +\color{black}{\overbrace{f(y)}^{\Large ?}}\quad\quad\quad\quad\tag{A}}\end{align}$$ where $f(y)$ is an unknown function of $y$.
Similarly, $$Q=\color{#A0F}{\frac{\partial u}{\partial y}}=x+2y$$
$$\begin{align} \implies \color{#180}{u=xy + y^2 + \color{black}{\overbrace{g(x)}^{\Large?}}\quad\quad\tag{B}}\end{align}$$ where $g(x)$ is an unknown function of $x$. 

Comparing both requirements we see that $\color{blue}{u=xy + y^2 + c}$ where $c$ is a constant.

The first part that is confusing me about these notes is the word $\color{red}{\fbox{match}}$. What are we matching?
My interpretation of the word $\color{red}{\fbox{match}}$ in this context means that if $u = xy +f(y)$ AND $u=xy + y^2 + g(x)$ then $u=xy+y^2 + f(y) +f(x)$ but this is obviously not the same as $\color{blue}{u=xy + y^2 + c}$. Why is my interpretation wrong?
My second query is marked with question marks above the overbraces of equations $\color{#180}{(\mathrm{A})}$ and $\color{#180}{(\mathrm{B})}$.
After we integrate $\color{#180}{(\mathrm{A})}$ and $\color{#180}{(\mathrm{B})}$ with respect to $x$ and $y$ respectively; I don't understand why we need an unknown function of $x$; $f(x)$, and an unknown function of $y$; $f(y)$. Why must these functions be present in $\color{#180}{(\mathrm{A})}$ and $\color{#180}{(\mathrm{B})}$?
 A: We have two equations 
\begin{align*}
u &= xy + f(y) && \color{#180}{(\mathrm{A})}\\
u &= xy + y^2 + g(x) && \color{#180}{(\mathrm{B})}
\end{align*} 
Both of the expressions on the right hand side are equal to $u$ and hence each other (we are 'matching' the two expressions for $u$), so we see that
\begin{align*}
xy + f(y) &= xy + y^2 + g(x)\\
f(y) &= y^2 + g(x).
\end{align*}
As the left hand side depends only on $y$, but not on $x$, the same must be true of the right hand side. It follows that $g(x)$ must be a constant function, $g(x) = c$, so $f(y) = y^2 + c$. Substituting into either $\color{#180}{(\mathrm{A})}$ or $\color{#180}{(\mathrm{B})}$, we obtain the solution $u = xy + y^2 + c$.
As for your second query, given the equation $\frac{\partial u}{\partial x} = y$, we would like to determine $u$. That is, we want a function $u$ such that its partial derivative with respect to $x$ is $y$. Of course $xy$ is one such function, but so is $xy + f(y)$ for any function $f$ because $\frac{\partial}{\partial x}f(y) = 0$. This is precisely the same reason why we add a constant of integration when antidifferentiating a function of one variable.

Here's the other approach I mentioned in my comment.
We have equation $\color{#180}{(\mathrm{A})}$ and we know $\frac{\partial u}{\partial y} = x + 2y$. Differentiating $\color{#180}{(\mathrm{A})}$ with respect to $y$, we now have the two equations
\begin{align*}
\frac{\partial u}{\partial y} &= x + f'(y)\\
\frac{\partial u}{\partial y} &= x + 2y.
\end{align*}
Therefore 
\begin{align*}
x + f'(y) &= x + 2y\\
f'(y) &= 2y\\
f(y) &= y^2 + c.
\end{align*}
Substituting this back into $\color{#180}{(\mathrm{A})}$, we see that $u = xy + y^2 + c$.
