The main cause of pigmentation is an overproduction or uneven distribution of melanin in the skin. This can be triggered by various factors, including excessive sun exposure, hormonal changes (such as during pregnancy or with hormonal imbalances), skin injuries or inflammation, certain medications, and genetic predisposition.