How do people get so black?

Dark skin is caused by a pigment called melanin, which protects the cells beneath from sunlight. People whose ancestors came from tropical climates where sun damage is a problem tend to have dark skin, while people whose forebears came from more northern climates need and usually have less melanin, and are therefore usually lighter.