Does the payload of an ICBM or regular airplane bomber explode if the ICBM or bomber is shot down?
Usually it won't set off the payload. 

The payload is designed in a way to prevent it from going off prematurely - say it needs to be armed before it can go boom. Usually you would only arm the trigger mechanism in the end phase - directly before payload delivery since you want to hit your target and not your own installations.

Modern explosives are remarkably unwilling to go off without the correct primer. Some of them will not explode even when set on fire (and just burn in that case). However some others might go off if they just get heated enough.

For nuclear weapons, it's even more difficult to determine. If the conventional explosives go off in an unpredicted pattern, you might have a conventional explosion but not a nuclear. If these explosives do not go off in the right pattern, the bomb might never reach criticality and fission (and possibly fusion) stage of the weapon will never trigger. In any case, wherever it went of, the bomb might scatter plutonium, uranium and other radioactive material where it was shot down.

That said, an aircraft or missile crashing can cause ordnance to arm and there was at least one case where a US bomber with live nukes crashed, the bombs partially got armed on crash but didn't trigger in the end. https://en.wikipedia.org/wiki/1961_Goldsboro_B-52_crash