If you have not already, reset PRAM
http://support.apple.com/kb/HT1379
and if that does not help, reset SMC
http://support.apple.com/kb/HT1543
which is basically unplugging all cables and power, and then reconnecting using a precise procedure. If the iMac is connected to an over-crowded or old power strip (surge suppressor), try connecting it directly to the wall outlet, at least initially. You should power it up with nothing but the power cord connected. If it starts up normally, only connect the standard keyboard/mouse and use it that way for a bit. If it continues to run normally, add one peripheral device (USB and FireWire) at time. If this problem recurs at some point, note which device was added last. It may be faulty in some way that is causing the iMac to not run reliably.
If the problem with booting continues, even with nothing connected, please post back.