All depends on the game. I only play on Huge, Fractal maps with 18 total civilizations. So things get a little crazy at times.
Early on, when I only have 8-10 cities, I try to have 2-4 units in each city. One for each "anti-unit" specialization along with a medic. Then I create 2 power stacks for offense / defense, usually 6-24 units in each stack. That lets me react to threats or prepare for war. Along the coastline, I make sure I have at least 3-5 ships fleets stationed in places where I can cut-off any inbound invasion force. It's better to kill those troop carriers before they land!
Later on, I'll look at what the AI is doing and go slightly stronger. Maybe as many as 5-6 units in each city across the board. In a pinch, I can pull 1-2 units from multiple cities to form a new reaction force to defend a city that is under attack.
The AI typically has a simple, brain-dead, battle plan. It masses an assault stack, will attack with singles and doubles of seige units, and will focus everything on a single attack point. As long as you can reinforce that city with enough defenders with 1 or 2 promotions, the AI will splinter it's stack of doom against your city walls.
So I usually declare war, hunker down and wait for their stack to arrive. Once their stack has suicided against my defense point, I turn around and take their closest cities in surgical fast-moving invasion fashion (no pillaging).