How to shorten file urls So for a file the standard url is example.com/sites/default/files/the_file.pdf how can I get rid of the leading /sites/default ?
If you want to get rid of the /sites/default/files/ part and change it to something shorter then just go to the admin menu and follow Configuration > Media > File System   

( Or just follow the url : /admin/config/media/file-system )

There set your Public file system path and Private file system path to what ever you want.

---- EDIT ----
Actually the above is valid for Drupal 7.
For Drupal 8 you will have to change the value of $settings['file_public_path'] in the settings.php file, as mentioned by 4k4.
In D8 the Configuration > Media > File System page displays these two parameters but no longer allows editing them.
----END EDIT----  

So you could change your sites/default/files to something like resources for example.

And then your files will have   urls like this : example.com/resources/the_file.pdf
instead of what you had : example.com/sites/default/files/the_file.pdf

Also make sure that :
  - your resources directory exists, and
  - is located at your web document root directory, and
  - is writable by your apache user (or whatever webserver you use).

Of course, this will be fine for a fresh setup, but if you already have a lot of contributed stuff then changing these settings may impact on your existing node contents.