First, a power outage is just like pulling the plug while your computer is on ( sleeping or not ). That's not usually the best way to "shut down" any computer. Period.
Second, a "surge protector" is better than a stick in the eye, but not by much. It will do absolutely nothing for a power outage. Nor will it help in a low voltage situation ( brown out ). And most will not even do much for a real surge of power. Many will simply 'sacrifice' a part and become useless for their intended purpose from that time on. If designed properly, they will notify you somehow that they have 'given their life' and saved your equipment ( a light, a sound, some smoke? ).
Apple has always used high quality, buffered power supplies. That is a great way to filter/smooth the power from small peaks and lows. But the only way to guard your expensive equipment is with an
Uninterruptable
Power
Supply. There's a link to APS in
Sir Pendragon's post above. There are other brands. Read and compare as many as possible and check carefully what/how they do their magic.
But also be aware that they actually will only provide power to a certain number of devices, one doesn't normally power a printer from the protected outlets ( lasers simply draw way too much power and inkjets don't need to even be on when you're not printing ). Nor will they power anything forever. You usually buy a unit that will power as many computers as you'll have running fro at least long enough to power them down, normally. Many good
UPSs will do the powering down ( shutting down ) automatically ( that could be helpful if you have the machines running when you're not at home ).
The side benefit of a good
UPS is that they also protect you from the brownouts as well as the surges. But in a different way than most inexpensive 'surge protectors'. Of course, since they do so much more and some things so much better, they end up costing more. But I think you certainly can get your monies worth, especially if you value the info on your computer.