How does wordpress know what blog ID to use for the next registration?

See topic.