A general probabilistic spatial theory of elections