What is an UPS at all?
UPS stands for Uninterruptible Power Supply. An UPS will make sure that your Raspberry Pi keeps running even if there is a power outage. It also allows you to properly shut down your Raspberry Pi in this case, eliminating the risk of data loss and operating system damage.

In a nutshell: How does this UPS work?
The Raspberry Pi will simply be powered by some rechargeable USB power bank, while the power bank itself will be powered by the power grid as usual. The UPS uses a simple trick to be able to detect a power outage (see next question).

How can the Raspberry Pi detect a power outage?
The Raspberry Pi will assume that there is a power outage if the wired LAN connection goes down. See hardware setup for details.

How can the Raspberry Pi know the current charge level of the power bank?
The charge level of the power bank is determined by the power bank's capacity and the system power consumption. This works quite accurately.

For how long can this UPS power the Raspberry Pi?
This of course depends on the used power bank, but typically between a few hours and more than an entire day (i.e. 24 hours).

Will the power bank recharge automatically?
Yes. As soon as the power outage is over, the power bank will automatically recharge. Also note that the charge level of the power bank will of course still be computed correctly while recharging.

Isn't it a problem to permanently charge a USB power bank?
Modern USB power banks have an integrated power management system which will protect the power bank from both overcharging and deep discharging, so it generally is not a problem. I've confirmed this on my own by continuously connecting my USB power bank to the power supply for several months, without having any issues. However, please note that you may still need to get a new power bank from time to time, since every power bank has of course only a limited lifetime.

Can I use this UPS to automatically boot up my Raspberry Pi again?
No. This UPS is intended for ensuring the continuous operation of your Raspberry Pi. Once the Raspberry Pi has been shut down, you have to manually boot it up again. The Raspberry Pi will also continue to consume power after it has been shut down until the power bank is empty, since it can't turn itself off completely (but note that the power bank will automatically recharge as soon as the power outage is over).

Hardware setup

I don't have any LAN. What should I do?
Go to the hardware setup page and use the provided Amazon link there to order a cheap LAN switch along with the required USB power bank. (You don't have to connect the switch itself to any network.)

Can I also use WLAN instead of the wired connection?
No. Wireless connections are unreliable and don't support an easy detection of the link status.

My Raspberry Pi doesn't have a LAN port. What should I do?
Either use a Raspberry Pi model which comes with a LAN port, or use a USB to Ethernet adapter.

Can I also use a USB port as power source?
Yes, but you'll either need to use two USB ports or use a single USB port which can provide sufficient power (like e.g. a USB 3.0 port or a USB 2.0 port which can provide at least 900 mA of current). You also need a USB-powered LAN switch. To get suitable hardware components, simply go to the hardware setup page and choose "USB port" als desired power source there. Finally, note that you however won't be able to automatically boot up your Raspberry Pi again after a power outage.

Software setup

Do I need to install any software on my Raspberry Pi?
You can install the upsd (Uninterruptible Power Supply Daemon) program on your Raspberry Pi to enable some cool features.

Which license is it?
It's GPL, so it's free software. The full C source code is available for download.

How do I install / configure / run it?
See software setup.

Is it possible to directly shut down the Raspberry Pi if there is a power outage?

Is it also possible to keep the Raspberry Pi running until the power bank becomes empty?
Yes. If the power outage should be over before the power bank becomes empty, then the Raspberry Pi of course doesn't have to be shut down.

Where can I download the source code?
See software setup.