How do Mars rovers send data back to Earth? Do they have some kind of built in WI-FI routers or is there any other connection?
Generally what happens is that radio signals are sent from the Martian surface to a spacecraft orbiting Mars, which then sends the data to Earth.
As an example, the current NASA missions on the Martian surface (Perseverance, Curiosity, and InSight) send data via radio signals to the Mars Relay Network, which consists of various NASA and ESA Martian orbiters. This network then relays the radio signals to Earth that is picked up by a network of three radio antenna facilities known as the NASA Deep Space Network.