It's difficult to see how you get this code without seeing the reference. I altered it based on a Wikipedia article.
bairs[pol_, p0_, m_] :=
Module[{n, a, r, s, j, b, c, d, f, , g, h, tol},
tol = 1/10000; n = Length[pol] - 1;
Table[a[i] = pol[[n - i + 1]], {i, 0, n}];
r = p0[[1]]; s = p0[[2]];
Do[
b[n] = 0; b[n - 1] = 0;
Table[b[i] = a[i + 2] + r b[i + 1] + s b[i + 2], {i, n - 2, 0, -1}];
c = a[1] + r*b[0] + s*b[1];
d = a[0] + s*b[0];
f[n] = 0; f[n - 1] = 0;
Table[f[i] = b[i + 2] + r f[i + 1] + s f[i + 2], {i, n - 2, 0, -1}];
g = b[1] + r*f[0] + s*f[1];
h = b[0] + s*f[0];
{r, s} = {r, s} +
1/(-s*g^2 + h*(h + r*g))*{{-h, g}, {g*s, -g*r - h}}.{c, d};
Print["{r,s} ", {r, s}], {m}];
Print["El factor cuadratico es: x^2", If[-r > 0, "+", ""], N[-r, 4],
"x", If[-s > 0, "+", ""], N[-s, 4]]]
This version seems to work reasonably well. It was taken, with very minor adjustment, from:
http://en.wikipedia.org/wiki/Bairstow%27s_method