It works as follows:
Then ak converges quartically against 1/π; that is, each iteration approximately quadruples the number of correct digits.
See also Borwein's algorithm (others) for an explanation of other algorithms by Jonathan and Peter Borwein to determine the digits of π.