When the U.S. and the Soviet Union were testing their nuclear bombs during the Cold War, they did the testing above ground. Why does North Korea test their nuclear weapons below ground, and how is it even possible to test a nuclear weapon underground?
3 Answers
Why?
We now understand that nuclear explosions produce fallout, especially ground bursts. That was only partly understood in the early years, and there was a war on. It is much smarter to test deep underground, especially if one has nothing the size of Nevada or Kazakhstan.
How is it possible?
The effects will differ when there is an underground burst, but North Korea is not trying to investigate the effects of a ground burst or air burst. Those are known well enough for their purpose in open literature. What North Korea wants is to prove that they can cause a nuclear explosion -- that can be done underground.
It is an interesting question if North Korea has a weaponized warhead or "only" something the size of a room, but it would be stupid to assume that their warheads are not weaponized.
Besides all the reasons given in the other answers, doing an atmospheric nuclear test would piss a lot of countries (including probably NK's few supporters) for little gain.
Atmospheric nuclear tests are incredibly contaminant; to give you an idea since the beginning of the atomic era, to build Geiger counters it has been convenient to rescue steel from sunken ships because of nuclear contamination of newly produced steel.
In fact there is an international ban on atmospheric (above ground) nuclear tests, and even nuclear powers that are not part of the treaty(like France or China) have refrained from performing atmospheric tests.
Whatever the true purpose of the tests are checking the design or threatening other countries (or both), this can be achieved the same with underground tests.
Additionally, making atmospheric tests would probably give US intelligence more opportunity to check the current state of NK's weapon design, by giving it opportunity to take satellite pictures of the devices. And if a test failed, it would be easier to conceal the embarrassment.
PS: And of course, AFAIK "underground test" does not mean that they just bury the device; they usually use caves or abandoned mines or purpose-built underground galleries. And given that seismographs placed thousands of kilometers away from the site can detect and give a good estimate of the explosion magnitude, sensors placed near it should have little trouble getting the data they want.
Another reason why the United States and Soviet Union (USSR) could test above ground is that they both have large empty parts of their countries. The US tested in New Mexico and Nevada, which are sparsely populated deserts, and on islands in the middle of the Pacific. The Soviet Union had Siberia.
North Korea is smaller than New Mexico and much more densely populated. It couldn't test above ground without causing explosion damage much less fallout damage to its populace. Lighting off the explosion below ground reduces the scope of the explosion and the fallout.
It's also worth noting that both the US and USSR engaged in below ground testing once the fallout issues were better understood.
Wikipedia has a list of nuclear test sites.