I believe people voted for him, for the most part, in spite of his racism and lack of basic knowledge about governance. Trump's lifestyle embodies the aspirational opulence that represents the id of the American psyche.
A Reader's Digest poll says 19% of Americans believe they're in the top 1% and I would argue the other 81% think they'll get there at some point in their lives. New York columnist David Brooks notes that in the 1950s 12% of high school seniors viewed themselves as a very important person; forty years later that number rose to 80%.
In the minds of his voters, Trump is living proof that anyone can make a lot of money and rise to the highest position in the land, regardless of innate intellectual ability. His success reinforces their tenuous hold on their own self-importance even though Trump's policies run counter to most of his voters' interests.