First Phil Plait assumes Gliese 581g is the closest potentially habitable planet to us. Given that assumption, he estimates the number of potentially habitable planets in the entire Milky Way.
There are 20 trillion cubic light years of volume in the Milky Way. Divide the volume of the galaxy by the density of stars with planets to get 2.5 billion habitable planets.
There is a report that as many as 1/4 of all the sun-like stars in the Milky Way may have Earth-like worlds. Briefly, astronomers studied 166 stars within 80 light years of Earth, and did a survey of the planets they found orbiting them. What they found is that about 1.5% of the stars have Jupiter-mass planets, 6% have Neptune-mass ones, and about 12% have planets from 3 – 10 times the Earth’s mass.
This sample isn’t complete, and they cannot detect planets smaller than 3 times the Earth’s mass. But using some statistics, they can estimate from the trend that as many as 25% of sun-like stars have earth-mass planets orbiting them!
If 25% of the stars in the galaxy are like the Sun (that’s a rough estimate, but close enough). That’s 50 billion stars. If 25% of those have earth-mass planets, that’s about 13 billion total.