Don't you have to upload the static files of data and styles folders to the CDN network?
No, you don't have to. Although, this is certainly an option. You can use FTP upload or rsync (for constant/regular) sync if you want to. This is a PUSH zone.
Or do they somehow automatically download them from your site and save on their servers and serve them from there?
Yes. When a client/user requests a URL they don't have stored locally, they http/https request it from your server then cache it and serve it locally from then on. This is a PULL zone.
How often do they download them in that case?
According to the expiry period set by your web server, or you can override it within your KeyCDN advanced settings and set the expiry time. Generally you set static files to expiry after 30 days.
Can you give a further example of what I should have in my config.php file?
Yes. This post