The Cold War ended with the Soviet Union and the entire Soviet bloc falling apart in 1989 and the early 1990s. The best-known date in this process was the fall of the Berlin Wall in November of 1989. By Christmas of 1991, President George H.W. Bush was willing to say that the Cold War had ended.
To answer this question directly, then, the Cold War ended through a "surrender" on the part of the Soviet Union. The Soviet Union essentially gave up on its efforts to spread communism and, eventually, its entire commitment to communism. It did so largely because its communist system was not able to give its people the material prosperity or the personal freedoms that they wanted. Pressure from within that was caused by this failure ended up forcing the Soviet Union to give up the Cold War struggle against the US.