The following explanation is taken from both Dr. Halsey's journal and The Fall of Reach (some of my personal speculation is present as well). Also, it's fairly lengthy. You have been warned:
Cortana is a "smart" A.I. created by Dr. Halsey. These units can improvise and come to their own conclusions, while more conventional "dumb" A.I. units cannot. This comes at a price, however, as they constantly collect and store data, which eventually results in a catastrophic overload of sheer data. Eventually these units "think" themselves to death. Halsey wanted to create a "smart" A.I. that lasted longer than the typical four to seven year lifespan of most units. To do this, she flash-cloned herself and took the brain of the most promising one to augment the existing A.I. data. The process was highly unethical since the clones were mostly just shells with brains, but she deemed it a necessary measure. It's hard to explain, but she essentially took all the knowledge in her mind and "gave" it to Cortana.
Moreover, the Cortana you see in Reach is not the "real" Cortana. Dr. Halsey needed Cortana's assistance in translating and storing the data from the "latchkey" discovery, but the A.I. was also needed in action with the Master Chief. To accomplish both tasks at the same time, Halsey copied Cortana, gave the original to the Chief, and kept the copy for the translation process. When the Covenant attacked Sword Base, the copy needed to be reunited with the original to transfer the vital Forerunner data. To accomplish this task, the copy selected Noble Six for the task of safe transport to the Pillar of Autumn, which was in drydock (Yes, it directly contradicts the space battle depicted in The Fall of Reach, but Bungie has stated that the games trump the books with regards to "official" canon).
In order to prevent the enemy from discovering the location of Earth, all UNSC ships are required to take randomized coordinates out of any star system after any action with the Covenant. When Reach fell, Captain Keyes gave such instructions to Cortana. What he didn't know was that she actually chose a very particular set of coordinates. The "latchkey" discovery held the coordinates to the Halo installation. Informing Keyes about it would have been too much of a security risk, so Cortana merely made it look like her decision was randomized. Thus, the Forerunner data that Cortana and Halsey interpreted coupled with the safe transport of said data by Noble Six made the events of the first Halo game (and its sequels) possible.