If say you have the expression

, we can't try and factorise it normally. So what we'll try to do is 'complete the square', that is we'll add in a term that allows us to nicely factor a perfect square, but to keep the expression the same on both sides we will also need to take away this term. Then we aim to have a perfect square and another negative term which we can then us DOPS (different of perfect squares) on to get two nice factors.
So if we had

what do we need to add to get a nice perfect square? We need to add a

, as this will allow us to factorise it into
^{2})
. Now there's a general rule for this, we add a constant that is the coefficient on the

term, half it and then square it. So in this case that is

, then square it, but remember to keep both sides balanced we also need to subtract it away again. So we have
^{2}-\left(2\right)^{2}+1<br />\\ & =\left(x+2\right)^{2}-3<br />\end{alignedat})
The term that ends up added to the

term inside the bracket will be what we go to square, in this case

.
Now we can use DOPS on what we obtain, as we have a negative in front of the constant left over, so we'll have
(a-b))
where

is the square root of our first term,
^{2}}=x+2)
, and

is the square root of our second term,

.
^{2}-3 & =\left(x+2+\sqrt{3}\right)\left(x+2-\sqrt{3}\right)\end{alignedat})
Now we should also note that this only works if the coefficient on the

term is

, so sometimes we'll need to take that factor out first, then try to complete the square.
Let's try a more general example, let's try and complete the square, then factorise

.
Since the coefficient on the

term is

and not

, we need to take a factor of

out of the expression.
<br />\end{alignedat})
Now we need to add and subtract the square of half of the coefficient on the

term.
x+\frac{c}{a}\right)<br />\\ & =a\left(x^{2}+\left(\frac{b}{a}\right)x+\left(\frac{b}{2a}\right)^{2}-\left(\frac{b}{2a}\right)^{2}+\frac{c}{a}\right)<br />\end{alignedat})
Then we can now factorise the first three terms of the expression.
x+\frac{c}{a}\right)<br />\\ & =a\left(x^{2}+\left(\frac{b}{a}\right)x+\left(\frac{b}{2a}\right)^{2}-\left(\frac{b}{2a}\right)^{2}+\frac{c}{a}\right)<br />\\ & =a\left(\left(x+\frac{b}{2a}\right)^{2}-\frac{b^{2}}{4a^{2}}+\frac{4ac^{2}}{4a^{2}}\right)<br />\\ & =a\left(\left(x+\frac{b}{2a}\right)^{2}-\frac{b^{2}-4ac}{4a^{2}}\right)<br />\end{alignedat})
Now finally we can use DOPS to get our two factors.
x+\frac{c}{a}\right)<br />\\ & =a\left(x^{2}+\left(\frac{b}{a}\right)x+\left(\frac{b}{2a}\right)^{2}-\left(\frac{b}{2a}\right)^{2}+\frac{c}{a}\right)<br />\\ & =a\left(\left(x+\frac{b}{2a}\right)^{2}-\frac{b^{2}}{4a^{2}}+\frac{4ac^{2}}{4a^{2}}\right)<br />\\ & =a\left(\left(x+\frac{b}{2a}\right)^{2}-\frac{b^{2}-4ac}{4a^{2}}\right)<br />\\ & =a\left(x+\frac{b}{2a}+\frac{\sqrt{b^{2}-4ac}}{2a}\right)\left(x+\frac{b}{2a}-\frac{\sqrt{b^{2}-4ac}}{2a}\right)<br />\end{alignedat})
Now if we were to solve for this to be equal to zero (to find

intercepts), then what do we get? Does it look familar?
\left(x+\frac{b}{2a}-\frac{\sqrt{b^{2}-4ac}}{2a}\right) & =0<br />\\ x & =-\frac{b\pm\sqrt{b^{2}-4ac}}{2a}<br />\end{alignedat})
That's right, we end up with the quadratic formula popping out

Anyways, hope that helps clear it up a little bit

EDIT: To summarise it step-by-step.
1. Take a factor out of the whole expression to make the coefficient on the

term to be

.
2. Add and Subtract the square of half of the coefficient on the

term to the expression, write this inbetween the

term and the constant term.
3. Factorise the perfect square formed from the first three terms, this will normally be

plus (if the coefficient on the

is positive) or minus (if the coefficient on the

term is negative) the constant we added previously, all squared. Simplify the leftover constants.
4. Make sure the leftover constants give a negative constant, otherwise we cannot use DOPS and get stuck here with no solutions.
5. Use DOPS to find the two factors, the first will be what we had inside the square from the first factorisation plus the square root of left over constant term (not including the negative), the second factor will be the same except we have a minus instead of a plus between the two pairs.
EDIT2: Try completing the square on

.