Either have factory tow wiring, or select a dedicated system from the likes of PJ Jones. If you fit universal wiring, the reverse sensors start with every selection of reverse until you switch them off completely.
Factory or dedicated systems employ a module that detects a trailer is connected, and switches off the reverse sensors. On BMWs it also cuts the cars fog lights and brake lights, to avoid back glare from the caravan. A revers camera continues to function.