A simple, and cheap surge protector protects you from spikes in voltage. If you do not have your computer plugged into a good surge protector, it's your fault.
For low voltage, a power conditioner or UPS can help. Tho, I rarely see damage from low voltage.
Why no damage from low voltage? Because international design standards even 40 years ago - long before PC exists - demanded no damage from any low voltage. In fact, the low voltage region on one chart is quite blunt about it - in all capital letters: "NO DAMAGE REGION".
But many only learn about electricity from myths. Or see damage, then use wild speculation to ‘know’ why damage exists. Some myths to confront:
Shorting a power supply causes damage. Nonsense. Intel even defines how large the shorting wire must be to test that supply. You must short all outputs from any powered on supply and no damage results. A standard long before PC existed.
No power supply must damage any motherboard or other components. More standards that existed long before Intel also demanded same.
Any protection that might work on a power supply's power cord already exists inside the supply. Routine even 40 years ago (again international design standards) was 120 volt electronics to withstand up to 600 volts without damage. Today, ATX specs put that number in excess of 1000 volts. Worse, a protector adjacent to electronics even gives surges more destructive paths. May even compromise protection inside a computer.
Effective surge protection in any facility that can never suffer damage is as close to earth ground as possible. And (in the case of telco switching centers) up to 50 meters separated from electronics. So that protection inside any appliance is not overwhelmed, the rare and destructive surge must be earthed before it can enter the building. And best performed distant from electronics. Separation between a protector and electronics increases protection.
Surges occur daily only when junk science replaces common knowledge. How often is a dimmer switch destroyed every day? Where is a protector that protects it? Even dimmer switches are so robust as to make ‘dirty’ electricity irrelevant. Computers are required to be even more robust.
How robust? Some of the dirtiest electricity comes from a UPS in battery backup mode. Of course, the many who know without learning numbers would believe popular myths. The numbers from this typical 120 volt UPS in battery backup mode. Its output voltage is two 200 volt square waves with a spike of up to 270 volts between those square waves. This voltage can be harmful to small electric motors and power strip protectors. And since electronics are so robust, this same UPS power is ideal for electronics.
Power that must never harm electronics can be harmful to small electric motors and power strip protectors - devices that are not as robust. Numbers that popular myth forgets to include. Too many above posts are nothing more than wild speculation when the author forgot to first learn basic electric principles. And never once posted numbers.
More numbers. The specifications on all electronics define normal voltage so low that an incandescent bulb at 50% intensity is perfectly ideal voltage to any electronics. That same low voltage may be harmful to the refrigerator, furnace, or dishwasher. One need only learn simple electrical concepts and the numbers to see why that is so.
Why is voltage held so stable to not dim bulbs to 50% intensity? Because voltage variations can cause air conditioner and fan motor damage. Why do so many worry about voltage variations to a computer? Because they believed what they were told to believe rather than first learn any numbers. That and knowledge only from observation are called junk science reasoning.
Why are those myths so widely believed? Because ineffective and obscene profit products are sold to cure those myths. For example, what is a power strip protector? A $3 power strip with some ten cent protector parts selling for $25 or $150. With profit margins that high, even I would be posting those lies.
How much power does a computer consume? Typically 200 watts. Therefore install 350 watt supplies. However, due to what they are measuring, some 350 watt supplies are also called 500 watts. No, they are not lying. They are just measuring something different.
To hype better 'quality', another myth is what Tim Allen so routinely mocked, "More Power!". More wattage does not mean a better supply. In fact to cut costs, some supplies sell more power while forgetting to include other essential functions. If the computer boots, the naive will not notice the missing functions. Sell a 1000 watt supply without those functions for less than $60 means a higher profit margin compared to a 400 watt supply with all those functions for more than $60. Those who know without first learning numbers and what those basic functions are will, instead, hype the 1000 watt supply. And then suffer failures latter due to those missing functions.
I believe that is enough challenged urban myths for one day.