In more detail
Serving images, scripts and styles from nearby cuts Latency, takes load off the origin server and helps absorb traffic spikes and some attacks. A CDN runs many edge servers (points of presence) in data centres around the world, and DNS or anycast routing sends each visitor to a nearby one. On a cache hit the edge answers at once; on a miss it fetches the file from the origin, stores it and serves it. Because a CDN works by caching, Cache-Control headers decide how long copies stay fresh. Many CDNs also terminate TLS, compress files and filter attacks.
Why it matters
Seeing old content after a deploy usually means the CDN is still serving a cached copy until it expires or is purged; versioned file names such as app.3f9c2.js avoid the problem. Never let a CDN cache personalised responses, such as pages showing a logged-in user's data: Cache-Control: private or no-store prevents it.
Example
Cache-Control: public, max-age=86400
Age: 3600
Shared caches may keep the file for 86,400 seconds (one day). This copy has been cached for an hour, so it stays fresh for another 82,800 seconds before the edge checks with the origin again.