How can I download the source code for iOS?
iOS is a derivative of Darwin OS which is an open source OS released by Apple. You can browse Apple's open source archives and download the Darwin code from their Open Source Development site. That link contains the major release archives for all the Darwin-based operating systems Apple has produced to date.

What you don't get with those archives is the proprietary layers that Apple places on top of Darwin to build the shipped iOS and OS X operating systems you interact with. These include things like the GUI framework and some hardware drivers and what not. In a nutshell: you don't get the polish that makes it an Apple OS. But you do get the engine.

You can also gain access to the developer APIs made available by Apple by joining their iOS Developer Program. If you'd like to access the developer APIs and documentations you can enroll in the Apple Developer Program and you'll immediately be given access to beta builds of iOS as well as all the developer API docs.

I do not believe the JailBreakMe developer (at the time of writing he has accepted an intern position at Apple) had any special level of access to the proprietary and company-secret components that make up the iOS operating system. Just the Darwin source for the releases and the developer APIs.