How an election affects stock market performance depends more on how close and contentious it is than on whether the winner is Republican or Democrat, liberal or conservative.