> I am interested in how the databases that 'whois' queries are populated
As rid mentioned in his comment, this information comes from RIRs, who assign IP ranges to companies and other groups that request them. The WHOIS database is simply updated when an IP prefix is created or updated. When you make a WHOIS query, the RIR server is automatically contacted and the server simply returns a plaintext reply containing all the relevant information.
For example, ARIN (the North American registry) has a whois server for looking up data on IP addresses set up here: http://whois.arin.net