For as long as mankind has pursued honey bees, he has been fascinated by the shape of comb cells. Since that first discovery, many types of intelligence have been ascribed to honey bees that might result in their extraordinary ability to build perfect hexagons. If you ever tried to draw a regular hexagon, one with equal sides and equal angles, you know how difficult it can be.
But the most plausible theory is that honey bees do not actually build hexagons. Instead, they build wax cylinders that conform to the shape of their bodies. They take the secreted wax flakes, soften them with their mandibles, and assemble them in a tube around themselves. For worker cells, they build a size that just fits: small bees build small cells, and larger bees build larger cells.
The flattened areas result where two cells touch each other. The most obvious example can be seen in soap bubbles. Wherever two bubbles touch, a flat wall is formed. Imagine building row after row of tightly packed cylinders. If you warmed them up so the walls flowed like liquid, they would develop flat sides wherever they touched, just like soap bubbles.
Image courtesy of honeybeesuite.com