One possible solution is a float sensor to detect the water level in whatever you’re trying to pump, but that can get complicated when you’re talking about something as large as a pool.
LONDEX, LTD., 207 Anerley Road, London, S.E.20, have introduced a patented system (“Lectralevel”) of floatless liquid level control ... mercury switch for controlling the pump motor starter.