How does pepper enhance/increase the saltiness of a dish?
It's not just saltiness, but various taste sensitivities that are impacted by pepper.  Basically, piperine (the component in black pepper which causes its pungency) and capsaicin (the "hot" chemical in hot peppers) cause mild irritation and inflammation in the mouth when consumed.  That inflammation leads to additional sensitivity of taste receptors.  Saltiness, acidity (i.e., sourness), and feelings of hot and cold are generally the most impacted by this inflammation; all of these sensations are enhanced.  (For a brief summary of some of the various impacts of pungent pepper compounds, see here.)

However, in excessive amounts, piperine and capsaicin can inhibit the normal taste receptors for the major flavors.  But a small amount of inflammation, as produced by the relatively mild form of black pepper's piperine, will make parts of the mouth more sensitive and thereby enhance certain flavors, including saltiness.

(I don't know the details for which other spices you mention, but many spices have effects beyond the basic taste buds.  In fact, many substances are chosen as spices for the wide variety of bodily sensations they can cause, often resulting in pain or irritation, which is why they tend to be used in very small quantities.  Particularly other "pungent" spices -- ginger and cinnamon, for example -- also have mild irritating effects on the body, which might induce alterations in sensation and taste.)