There are two common systems in use today: standby UPS and continuous UPS. A standby UPS runs the computer off of the normal utility power until it detects a problem. At that point, it very quickly (in five milliseconds or less) turns on a power inverter and runs the computer off of the UPS's battery (see How Batteries Work for more information). A power inverter simply turns the DC power delivered by the battery into 120-volt, 60-Hertz AC power.
In a continuous UPS, the computer is always running off of battery power and the battery is continuously being recharged. You could fairly easily build a continuous UPS yourself with a largish battery charger, a battery and a power inverter. The battery charger continuously produces DC power, which the inverter continuously turns back into 120-volt AC power. If the power fails, the battery provides power to the inverter. There is no switch-over time in a continuous UPS. This setup provides a very stable source of power.
Source :
HowStuffWorks "How does a computer's uninterruptible power supply (UPS) work?"