Stationary configurations for the average distance functional and related problems