Why does the electron configuration for some elements not follow the diagonal rule?
The reason of these exceptions (from the diagonal rule) is that some elements are more stable with fewer electrons in some subshells and more electrons in others:


Electronic configuration of molybdenum: $[\ce{Kr}] \ce{4d^{5} 5s^1}$, instead of  $[\ce{Kr}] \ce{5s^24d^{4}}$ according to the diagonal rule, because a half-full $\ce{4d}$ subshell and a half full $\ce{5s}$ subshell are more stable than $\ce{4d}$ filled with four electrons and a full $\ce{5s}$ subshell.
Electronic configuration of Gold: $[\ce{Xe}] \ce{4f^14 5d^{10} 6s^1}$, instead of  $[\ce{Xe}] \ce{4f^14 5d^{9} 6s^2}$ according to the diagonal rule, because a full $\ce{5d}$ and half full $\ce{6s}$ subshell is more stable than $\ce{5d}$ filled with 9 electrons and a full $\ce{6s}$ subshell.
Electronic configuration of Palladium: $[\ce{Kr}] \ce{4d^{10}}$, instead of  $[\ce{Kr}]\ce{ 5s^24d^{8}}$ according to the diagonal rule, because a full $\ce{4d}$ orbital is more stable than $\ce{4d}$ filled with eight electrons.
Electronic configuration of Curium: $[\ce{Rn}] \ce{7s^2 5f^7 6d^{1}}$, instead of  $[\ce{Rn}] \ce{7s^2 5f^8} $ according to the diagonal rule, because a half full $\ce{5f}$ orbital is more stable than $\ce{5f}$ filled with eight electrons.