It's a basically a battery that plugs into the wall. You plug devices into the battery. Mine has surge protection for coaxial (T.V. type cable) also.
When the power goes out, whatever is plugged in keeps working. Your internet signal should keep working, just as your phone works when the power is out. You can plug your phone charger into the UPS when the power is out.
Some UPSs have software that, when the power goes out, will perform an orderly shutdown of your computer. This isn't needed as much with a laptop with a reasonable charge left, but will allow your laptop to last longer if it's plugged in to the UPS.
Vendors' web sites have calculators, etc. so you can predict how long the UPS battery will last (based on the power draw of what you want to plug in). You could also roughly figure out how long something will last based on the power draw as found in a device's manual.
UPSs can go from <$100 to probably tens of thousands if you run a data center (rows and rows of servers, routers, etc.).