First when you ask a question it is really helpful if you tell us what we are looking at. I was able to pull the part number off the picture of your board and get the schematic. It appears you have a line tracking mouse sold by Pololu ... datasheet here
https://www.pololu.com/file/0J175/line_tracking_mouse.pdf.
Below is my explanation of how the circuit works. for those of you who know electronics better than me feel free to jump in and tell be how bad this explanation is but i tried to simplify things and as a disclaimer electronics is not my expertise.
Assuming you have not altered the circuitry it appears the switch does not actually disconnect power from the motors but disconnects power from the logic circuit. RM and LM are the motors and the circuit functions the same way for both motors so i will only discuss the circuit for RM (right motor). you can see the
positive negative terminal of the motor is wired directly to the positive battery terminal. Q3 and Q5 are NPN transistors (they are connected in a configuration called a darlington pair) that turn the motor on and off. Basically when a positive voltage is applied to the wire coming into the left side of Q3 (base) the motor will be on when it is connected to 0 volts the motor will be off. the large box labeled EM78P156 is a microcontroller, this is programed with the logic that tells the motors what to do based on the sensor inputs. R6 is a current limiting resistor that is needed to prevent the microcontroller and transistor from getting damaged. R12 is a current limiting resistor for D5 (an LED that appears to show the state of the motor) and again functions to prevent both components from damage.
Are you are seeing erratic behavior from your motors when the switch is off (sometimes off and sometimes on)? if this is the case i suspect that the microcontroller output pin 12 (for the right motor) is floating. this means that it is not tied to any voltage and could be any value. to fix this you could try a couple things:
- install a switch that actually disconnects the motors from the positive side of the battery.
- install a 10k pull down resistor to the microcontroller output pins 12 to ground and 13 to ground
- contact Pololu and see what they recommend
in any case let us know what you find