In the following video, we work out the solution to a general linear first order ODE $$\frac{dy}{dx} + P(x) y = Q(x),$$ and apply the method to the example $$\frac{dy}{dx} + 2xy = 4x.$$
We always take our integrating factor to be $$I(x) = e^{\int P(x) dx}.$$ (The method doesn't depend on which constant of integration we choose. Just pick any anti-derivative of $P(x)$.)
Notice that $$I'(x) = P(x) I(x),$$ so $$\left(I(x)y\right)' = I(x) y' + I'(x) y = I(x)\left(y' + P(x) y\right).$$
Integrate both sides to get $$I(x) y = \int I(x) Q(x) \,dx.$$ This involves a constant of integration, which we'll write explicitly as $+C$.
Divide by $I(x)$ to get our general solution: $$y = \frac{1}{I(x)} \left ( \int I(x) Q(x)\, dx + C\right ).$$
Plug in the initial conditions to figure out what $C$ is.
In our example, $y' + 2xy = 4x$, since $P(x) = 2x$ we can take $I(x) = e^{x^2}$. Hence
$$y = \frac{1}{e^{x^2}} \int 4x e^{x^2} dx +C = \frac{1}{e^{x^2}} (2e^{x^2}+C) = 2 + C e^{-x^2}.$$