During World War II, the German military used a device known as an Enigma machine to send coded messages. The machine functioned somewhat like a typewriter with a maze of complicated mechanical and electronic connections. Any message typed into the machine would be transposed into a code; another Enigma with the identical set-up of wires and rotors could reverse the code and reveal the original message.
Polish code breakers had cracked the Enigma code and built duplicate Enigma machines before World War II. They shared their knowledge with the British, who used it, along with several captured Enigmas, to decipher an enormous volume of coded Nazi messages, some from Hitler himself. This information, codenamed ULTRA, was kept under tight wraps so that the Germans would not suspect that their messages were being read.
The acquisition and transmission of secret information is meaningless if the information isn't properly analyzed and acted upon. Russian leader Joseph Stalin was provided with information from several agents that Germany was going to break the German-Russian alliance and attack Russia during World War II, but he refused to believe it. Russian forces were not properly aligned or prepared when the German attack came.
Data analysts take information from numerous sources, not just spies, and develop an overall picture of enemy strategies and policies. This information is then written into briefings for political leaders. While information from a single source may be untrustworthy, additional sources can be used to corroborate the data. For example, U.S. code breakers had partially cracked the Japanese Purple code during World War II, and they were fairly certain that Japan was planning an attack at Midway Island. They weren't completely sure if they were reading Japan's code word for the island (AF) correctly, however, so they had troops positioned at Midway to issue a radio alert saying they were running short on fresh water. Shortly, Japanese communications were intercepted that reported that AF was low on fresh water, confirming the target of the coming attack.