A University of North Carolina researcher explains how polling failures, gambling legalization and political gridlock led to prediction markets.