Probably each CDN does it differently... but the one I know about does the second.... so it goes LB, first webserver on random node, and that first webserver knows where to grab the content from the second webserver on the proper node that has the content.