Facebook data: How it was used by Cambridge Analytica

Facebook has said it believes that up to 87 million users' data was improperly shared with Cambridge Analytica. Cambridge Analytica claims its data and research helped Donald Trump win the US presidency. How did it turn a Facebook user's data into a personality type, and what did it do with that information?