Postgres backups under the hood

With backups being such a vital part of keeping your data safe, how do they actually work?

Sources