If it's zvt, expand at 12 control unless you're at very close spots.
If it's zvz, depends on situation. I'm not too good at this mu.
If it's zvp, expand at 12 when you're at far away spots.
a popular build would be 12 hatch 11 pool. decent economy and lets you defend from offensive bunker. watch out for zealot rushes and 9-pool builds by enemy zerg.
All-in-all, experience will teach you this. 12 hatch(at expansion) 11 pool work best at a 12/6 or 3/9 scenario.
If it's zvp, you might wanna 12 pool 11 hatch to hold zealot rushes.
Scouting the enemy build will let you know when you can safely expand. Generally in zvt, 12 hatch 11 pool is fine. After the first overlord is done, make three more drones and use one of them to make a new hatchery.