How can one get malignant melanoma?

Genetic and UV. Melanoma is a malignant tumor of melanocytes. It does have a familial component - meaning there are genetic mutations that put you at higher risk for development of melanoma. Uv exposure (especially with tanning beds) can put you at high risk as well.
UV radiation. The most common way is from uv radiation from the sun. Severe sunburns lead to dna damage in the skin. The lag time between the skin damage and development of melanoma is about 30 years.
Many factors. We don't understand all of the causes of melanoma but know that it is a combination of ultraviolet exposure and genetic susceptibility.