The rare earth elements that help power electric vehicles, wind turbines, medical imaging machines and other advanced technologies may be hiding in an unlikely place: industrial wastewater.