Minecraft wiki entry for Iron_golem_farming, associated text: The village contains at least 20 beds.
The village contains at least 10 villagers.
100% of villagers are linked to a bed.
At least 75% of the villagers have worked at their workstation the previous day.
A player is within 80 blocks of the village horizontally and within 44 blocks vertically.
There is less than one naturally generated or spawned (i.e. not player-created) iron golem for every 10 villagers in the village. The ratio of iron golems to villagers is rounded down to the nearest whole number, so to spawn a second iron golem while the first is still alive requires 20 villagers, to spawn a third golem requires 30 villagers, and so on.