It is really not that much of a mystery. The development of surface-to-air missiles (SAM) had begun during the Second World War and the obvious benefits of this weapon system meant that both superpowers poured a good deal of time and resources into SAM development. The Soviets had a clear incentive to develop SAMs as they were an ideal way to defend the USSR's massive airspace against American bombers. SAM batteries could allow for a layered air defense network that worked in conjunction with manned interceptors. The S-25 Berkut (NATO designation SA-1) SAM, for instance, was a first-generation SAM system meant to defend Leningrad and Moscow from nuclear attack by American bombers. The S-25 though was too expensive for wide deployment and the Soviets continued to refine the design. These refinements included a two-stage propulsion system that would boost the SAM's effective range. The S-25's successor, the S-75 (NATO designation SA-2) was the result of these developments. The early generation S-75s had a high range, enough to reliably reach the American snooper aircraft that had been periodically violating Soviet airspace since the early 1950s. These aircraft were often converted bombers such as the RB-57 and their performance envelope did not match that of the U-2's.
The U-2 overflights prompted the Soviets to push for a high-altitude version of the S-75, the 11D variant. This SAM had more powerful rocket engines which allowed the 11D to reach altitudes of around 82000 feet. The initial U-2 flights in early 1956 took place before the 11D was operational, but the American U-2s' overflight of Soviet territory made its development a high priority underwritten by the Soviet leadership. Eisenhower had backed away from supporting the military overflights in his second term and he noted that the American public would be apoplectic if the Soviets engaged in similar overflights of US territory. But such reconnaissance flights were a calculated risk on the part of SAC as it allowed them to ascertain Soviet strategic potential and air defense response times when these were open questions. The Soviet's nuclear capabilities were also unknown at this time as were their actual bases. The fear of a "missile gap" as well as uprated engines for the U-2 justified the resumption of the U-2 overflights in 1960.
The problem for these overflights was that Soviet air defenses had grown more sophisticated in the four years since the U-2 had made its debut. Not only were the 11Ds (and a related development, the 13D) deployed, the Soviets also had a much more integrated air defense network and had been training to defeat the U-2 threat. Interception of the U-2 still was not easy task and the uprated engines as well as the US taking advantage of soft spots in the Soviet radar network allowed some of the 1960 flights to succeed. But this calculated risk came up short during Operation Grand Slam, the Powers mission which the Soviets managed to shoot down.
Although there was some speculation in the West that placed the onus for the shoot down on Powers (eg he fell asleep or was operating at much lower altitude than he should have been), the simple fact is that the Soviets placed a high priority on shooting down the U-2s. In addition to firing SAMs, they also developed high-altitude interceptors who were actually ordered to ram the spyplanes to bring them down to lower altitudes. The size of the S-75, Vietnam pilots nicknamed it the "flying telephone pole," also gives a sense of its potential range. A number of CIA analysts had warned that the U-2 was vulnerable to the developing SAM threat, but the later overflights were seen as justified given past successes and the urgent need to ascertain Soviet ICBM capabilities. The U-2, while not a sitting duck, was increasingly at risk of being shot down by Soviet air defenses.