A CDN stores copies of a site's pages, images, and files on servers around the world. Visitors are served from a nearby location, which reduces load times, and the origin server handles far less traffic. Most CDNs also provide TLS certificates and protection against some attacks.
For static and mostly static sites, a CDN can serve the entire site, which makes it fast, inexpensive, and resistant to traffic spikes. Dynamic applications use CDNs for assets and cacheable responses.