Do physicists understand what causes nuclei to decay? I know that it decays due to instability but do physicists understand what exactly leads to decay. I know about $Z$ and $W$ bosons but I mean before this occurs. What happens in the nucleus for a $Z$ and $W$ boson to be emitted?
 A: Nuclear decay is truly random. The probability depends exponentially on time, so the particles do not grow old or something. In that sense there is no "before this happens", no sequence of events that "leads to decay".
So all one can do is to try to calculate a half life. If theory can calculate such values, one can claim that the mechanism is completely understood.
You are asking about the weak force in complex systems. But only for the simplest case, decay of a neutron, attempts are made to calculate an accurate ab initio value for the half life.
Edit: It is impressive that current calculations find values that agree with experiments to within percents (see JEB's reference below).
A: The driving force for nuclear decay is energy minimization which is (roughly speaking) driven by the balance between electrostatic forces (which cause the protons to repel even when not touching) and the strong force (which makes protons and neutrons attract one another only at very close range).
The interplay between these forces varies as the number of neutrons and protons is varied in nuclei of different size, and creates some nuclei which are stable against decay and others which are metastable. The metastable ones increase their binding stability by either shedding helium nuclei (which can be imagined as a highly-asymmetric case of nuclear fission), by ejecting a neutron, or by converting a proton to a neutron or vice versa and shedding a neutrino or anti-neutrino and an electron or positron.
In so doing, the resulting decay products are more tightly-bound than the progenitor and therefore become more stable against decay, with the energy release showing up as kinetic energy of the decay products or as energetic photons. In some cases, the decay process involves several sequential steps with highly unstable intermediate nuclei inbetween.
As pointed out by Pieter, the timing of the decay event itself cannot be predicted, only its probability.
A: This is a comment to

What happens in the nucleus for a Z and W boson to be emitted?

Z and W  bosons are not emitted in  nuclear decays. Their mass is close to 100 GeV and the decay energies seen in nuclear decays are of order MeV, a thousand times smaller.
The answer by Nielsen and Pieter cover the way the instability appears. For weak decays there is a virtual emission of W or Z, not real on mass shell bosons. These weak decays can happen because the protons and neutrons that compose nuclei are themselves composed of quarks, and there is a probability for a quark to decay to another  quark , given the proper energy balances. See the decay of a neutron:


A more detailed diagram of the neutron's decay identifies it as the transformation of one of the neutron's down quarks into an up quark. It is an example of the kind of quark transformations that are involved in many nuclear processes, including beta decay.

