There are many ways to detect a nuclear explosion, and there are people working to detect it. The Comprehensive Nuclear-Test-Ban Treaty Organization or CTBTO is one such organization. They are using a global network called the International Monitoring System. This is capable of detecting any nuclear detonations anywhere on the Earth (underwater, or in the atmosphere, or deep underground).
First of all, please note that a nuclear explosion releases a lot of energy, and I mean a lot of energy. Ionizing radiation, shock-waves, and heat are all generated in a nuclear explosion.
Let's talk first about how to detect shock waves from a nuclear detonation. These waves can travel through the air, water, and ground at the relative speed of sound in each medium. The CTBTO use an Infrasound Monitoring System to detect shock waves traveling through the atmosphere. Infrasound is generated in exploding volcanoes, earthquakes, meteors, storms and auroras; nuclear, mining and large chemical explosions, as well as aircraft and rocket launches in the man-made arena. Nuclear generated shock waves in the air are easily detected since a nuclear explosion is much much more powerful then pretty much anything else in the natural world.
Underwater nuclear explosion can be detected using a Hydroacoustic Monitoring System. They are kind of microphones at the bottom of the ocean. Theses microphones also pick up sounds from underwater earthquakes, underwater volcanoes eruptions, submarines, whale, and of course, nuclear detonation. Like an above ground explosion, nothing beats nuclear generated shock waves in terms of intensity. Therefore, an underwater nuclear explosion is also quite easy to detect.
Underground nuclear detonations can be detected using seismometers. Seismometers are used mainly to detect earthquakes. Different from the Infrasound Monitoring System, which detects sounds in the air, seismometers detect sounds in the ground. Scientists have documented the various characteristics of shock waves created by earthquakes to volcanic activities to even planes crashing. Thus, if powerful unrecognized waves are detected, they can link their observations to nuclear detonation.
Shock waves can be detected by multiple sensors as described above. Scientists can use this result to triangulate and correctly pinpoint the site of a nuclear explosion. This is how we know that North Korea secretly detonated nuclear weapons in 2006, 2009, and 2013.
Lastly, to be sure if an explosion is nuclear, scientists need to confirm the presence of a radioactive dust cloud using Radionuclide Detection. However, in the case of a perfectly contained nuclear detonation, radioactive dust cannot be detected. Therefore, teams of inspectors have to be sent to the suspected site.