Some sites make use of a separate domain for images the website uses, for instance YouTube has ytimg.com and Twitter has twimg.com. I can tell the advantages of serving the pictures from the separate server why the various domain too? Would not it be better to just setup a subdomain like images.youtube.com to suggest towards the server which has the pictures?

The advantage is the fact that utilizing a separate domain entirely is it is going to be "cookie free", unless of course you place snacks for your domain obviously :). Meaning less overhead on demands. If you opt for a subdomain: snacks looking for google.com is going to be passed to images.google.com too. Micro optimisation really, but makes lots of sense should you push insane levels of traffic, like Google.

Additionally Merrimack's answer it is also helpful for those who have completely different sites/organizations/etc utilizing the same file handling/processing servers for storage and retrieval.