Power Fluctuations in My Area and Restarting of the iMac
Solution 1:
If your power actually goes out, even for a few seconds on occasion, a surge protector will not help with an actual outage and will not prevent restarts.
Most computers can withstand a restart and a surge protector will protect against voltage spikes during the stop and start of power. That should work fine.
If you do not wish the restart, or there are many restarts (you implied that in your question) then you should invest in a true Uninterruptible Power Supply. I use an APC (Schneider now) unit and my customers use the same thing.