1 billion hives
(at 10,000-50,000 bees/hive this is 10-50 trillion bees)
Managed: 100 million hives
Based on country-level data from FAO, supplemented for a few countries with Apiservices, in 2011 there were about 80 million managed hives. Because FAO lacks any data for some countries, and other countries under-report (for instance US figures don't include hives kept for pollination service and hives kept by small-scale operators) a reasonable round estimate of managed hives in the world is 100 million. (This implies a 128% correction to the FAO numbers). (Aizen and Harder 2009 give context on FAO figures).
Wild/Feral: 900 million hives
Wild/feral hives of Apis mellifera are difficult to count via direct observation. Jaffe et al 2010 use a genetic sampling method, and also report a reasonably strong correlation between the total number of hives (managed and wild) per square kilometer and the mean annual temperature of the area.
I used the best fit line from their data to estimate the "hive-carrying-capacity" by country using (the admittedly very general) land area and mean annual temperature. Then I subtracted the number of managed hives from the carrying capacity to estimate wild hives.
Although this formula probably overestimates large, cold countries and underestimates Africa (the formula gives 211 million feral hives in Africa when literature suggests closer to 300 million), in general, it seems to give not unreasonable estimates in comparison to the literature. Globally, this formula gives an estimate of 984 million wild hives. Given that land area included desert and other unsuitable habitat, it seemed reasonable to round down, and I took 900 million as my estimate.
FAO statistics date to 1961. I plotted their numbers, with the 128% correction for each year. I assumed that during this time the number of wild bees has remained virtually unchanged, at 900 million, because it was defined by mean temperature and land area, which have not changed.*
This period represents the globalization of Apis mellifera. Before 1600, there were no European honey bees beyond their native range (Western Eurasia and Africa). However, once established in new areas (the usually cited first beehive in the USA in 1622), Apis mellifera rapidly spread in both managed and feral populations, in North America (17th c), South America (18th c), Australia (19th c) and East Asia (20th c) (Crane 1999)
I used carrying capacity of native range countries (just about 35% of the carrying capacity of the globe, or 350 million hives) as a before-1650 estimate, and then assumed a geometric increase of about 2% per decade in available land area (ALA), as Apis mellifera bees and beekeeping made their way around the globe.
To estimate the number of managed bees during this period, I assumed a human:hive ratio of 35:1**, and modelled hives based on historical estimates of human population, multiplied by the ALA for the decade. The 1650 estimate was 5 million managed hives.
*Although diseases, pests, and pesticides have been reported to affect feral populations, I didn't find any solid information on this. For instance, feral populations of Apis mellifera mellifera and A. m ligustica have been widely reported to be in decline in the USA, but at the same time, feral populations of Africanized honeybees (Apis mellifera hybrids) have been rapidly spreading. Even with 90% losses in the USA, Canada, Japan, and Europe (areas affected by varroa) my estimates would only be decreased about 10%. However, it's also possible that land-use change has greatly affected feral bee populations (Moritz et al 2007).
**This wasn't a totally wild guess. I first calculated the human:hive ratio for 1961-2011. This ratio was increasing - there were 71 people / hive in 2011, and 47 in 1961. Initially, I assumed the rate of change in the ratio to be constant, but this led to unrealistically large estimates for historically managed hives. However, the rate was clearly increasing (just, perhaps in a nonlinear way I didn't want to estimate), so I decided instead to compromise on a number less than 47 and greater than 4. I decided on 35, as it produced what seemed like a realistic estimate of 5 million hives in 1650, compared to around 20 million today for Eurasia and North Africa (excluding sub-saharan Africa where wild-harvest remains important and likely was even more so in the past).
Aizen MA, Harder LD. 2009. The Global Stock of Domesticated Honey Bees Is Growing Slower Than Agricultural Demand for Pollination. Current Biology 19: 4–4.
Crane E. 1999. The World History of Beekeeping and Honey Hunting. Taylor & Francis. (Chapter 12).
Jaffé RR, Dietemann VV, Allsopp MHM, Costa CC, Crewe RMR, Dall'olio RR, Rúa PPDL, El-Niweiri MAAM, Fries II, Kezic NN, et al.. 2010. Estimating the density of honeybee colonies across their natural range to fill the gap in pollinator decline censuses. Conservation Biology 24: 583–593.
Moritz R, Kraus FB, Kryger P, Crewe RM. 2007. The size of wild honeybee populations (Apis mellifera) and its implications for the conservation of honeybees. Journal of Insect Conservation