The Keep is the master gate of the whole city: the world-map number is the Keep level (k25, k40...). No building can pass a given level until the Keep reaches it. Inside the Keep you exchange gems for gold (Levy), use City Buff items, assign a Duty Officer (unlocked Keep Lv16), change Culture and Decoration. Raising Keep level increases max generals held, free levies, gold per levy, gathering speed and in-city production speed. Each Keep level requires Walls at (n-1) plus a specific building: Lv4 needs Walls3+Farm3, Lv6 Walls5+Warehouse5, Lv21 Walls20+Sawmill20; some need research (Lv7 Conscription, Lv14 Adv Dispatch, Lv19 Adv Conscription). Building unlocks by Keep level: Lv2 Academy; Lv3 Tavern; Lv6 Archer Tower, Stables, Workshop, Market, Hospital, Quarry, Army Camp, Watchtower; Lv7 Forge; Lv8 Trap Factory; Lv9 Embassy, War Hall, Bunker; Lv11 Prison, Mine, Art Hall, Holy Palace, Subordinate City Portal; Lv12 Ideal Land; Lv21 Pasture and Research Factory; Lv27 Arsenal; Lv28/33 Wisdom Dome/Wonder gates; Lv30 Dragon Cliff, Wonder; Lv35 Victory Column; Lv36 Military Academy; Lv38 Triumphal Arch. Upgrade cost is Food/Lumber only through Lv6, Stone added at Lv7, Ore at Lv12; from mid-game all four are demanded in huge balanced amounts (Ore often the single largest late). Example Construction-Speed buff rises 0% (to ~Lv17) up to +600% by Lv50. Keep Duty Officer boosts Construction speed and Training Capacity (ideal Hera, Ashoka, Zhuge Liang, Menshikov). Because everything is Keep-gated, keep the Keep on Builder 1 nearly continuously; resource fields only need Keep-minimum levels.
Original research source: Evony Guide Wiki