First, it needs to be stressed that the notion that the Germans were really, really far ahead technologically is a bit overdone. They did make significant advances in a few fields, because they poured a lot of resources into them and had some good scientists and engineers. So rocketry is the canonical example. It didn't end up doing very much for them during the war, though — many the fields they focused on did not reach a level of maturity during the war that helped them out too much militarily. So the US and USSR wanted the fruits of the German rocket work not because it was really such a great weapon, but because they saw immediately that if you could advance that technology by another ten years and pair it up with nuclear weapons then you'd have a serious weapon. But during the war itself, the V-1 and V-2 were really just propaganda pieces ("terror weapons") — they had no serious military consequences.
The technologies developed by the Allies — radar, sonar, the proximity fuze, code-breaking/computers, napalm, the atomic bomb — these all ended up having major, major consequences for how the war was fought and won.
As for being "ahead" prior to the war, or early in the war... it comes down in part to science policy. Germany began preparing for war, and mobilizing science for "defense" purposes, in the 1930s. The UK did as well. The US, however, did not. Even after the lesson of World War I, where the US found itself woefully behind in terms of scientific warfare (e.g. chemical weapons) when it entered the war (the US had no Chemical Warfare Service, had no gas warfare training, no gas weapons of its own in 1918), it was still a slow-to-mobilize system. Vannevar Bush of the Carnegie Corporation (and an engineer from MIT) convinced FDR to create the National Defense Research Committee (NDRC) only in 1940 (a year after World War II started), which served to help coordinate university-industry-military research into weapons technologies. Even that was a relatively weak organization until FDR created the Office of Scientific Research and Development (OSRD) in 1941, and even then, things didn't get really cooking until the US was really in the war (early 1942). The OSRD could not only coordinate and fund research projects, it could also contract out the production of finalized components and get them sent to the front. Practically all of the cool World War II technologies that the US produced were created due to OSRD contracts and research.
Once an infrastructure for this kind of work was created, the US made great progress — tremendous progress, if you consider how late they started. A lot of this, it should be said, comes from being aided by the UK. The UK had been working on things like radar and the atomic bomb much earlier than the US had, but lacked the resources and time to bring them to fruition. They entered into a scientific exchange agreement with the USA and gave them their work, allowing the US to apply its considerable research and development resources to turn these good ideas into impressive results very quickly.
After the war, the US (finally) took away the lesson that government-coordinated scientific research was vital for defense, which explains so much of how the Cold War operated.
In order to answer this question better, can you tell me in what ways you believe that Germany was technologically ahead?
What gave the Germans the edge, at least initially, wasn't their technology but their tactics. They had gained experience in combat tactics prior to the war with their assistance in the Spanish Civil War. The main work horse tank for battling armor in the invasion of France was the Panzerkampfwagen III E/F series with a Panzerkampfwagen IV D for infantry support. Their armor and armament was lacking compared to the French S.35 and Char b1 Bis series tanks. The French lacked the numbers of those tanks when they mattered and were used poorly tactically.
If you look at the German's armor line up as the war progressed they had many slapped together variations of their own armor and other countries armor to help combat the lack of suitable tanks to fight the Soviets.
The Bf-109 series of fighters was the German's main fighter for the Luftwaffe. While it was bleeding edge prior to the war, as the war progressed it's role began to change. While it received better versions of the DB601 engine it needed it to help carry the weight of the weapons added to the airframe. The Germans put bigger cannons on their fighters to combat the Allied bombing formations which made the planes more sluggish when fighting enemy fighters. The Luftwaffe did gain the air edge in 1941 with the Fw-190 until the British responded with the Spitfire IX.
Germany's infantry weapons and tactics however, were fairly advanced. The MG-34 and MG-42 are considered by many to be the greatest machine guns of the war. The m240 that many NATO countries use today operates similarly to how the MG-42 does.
In the end, a lack of resources and an inferior industrial complex (although improved by Albert Speer), is what gave Germany no way to win against the Allies.