You need a zero-crossing detector; if you know when the voltage crosses zero and the frequency, you can figure out when the other spots are.
Here's a simple way to build one:
1) Connect a transformer to the mains - one that gives you about 5VAC works fine.
2) Put a full-wave rectifier on it. This gives you rectified AC voltage.
3) Hook the output to the base of an NPN transistor through an appropriate resistor (10K or so). The transistor will be off when the voltage is below about 0.7V, and on the rest of the time. This gives you a pretty good square wave, centered around the zero cross.
4) Hook it to the interrupt of a microcontroller, and set it to edge trigger on high to low. This gets you an interrupt a bit before zero crossing, and then you can use the timer on the microcontroller to generate the rest.
Okay, perhaps it's not quite so simple...