Turn off power at the circuit breaker for the room in which you are installing the motion-sensor switch.
Unscrew the light switch plate you will be replacing and gently pull it away from the wall. Unscrew the two screws holding the switch fixture in place and pull the fixture away to expose the power wires.
Use a circuit tester to confirm that the power to the switch is indeed out. With a noncontact tester, simply hold the tip against the black or red wire (hot wire) in the switch. If the light comes on, power is flowing. With a contact circuit tester, touch one lead to the black or red wire and the other to the neutral (white) ground (bare copper) wire. If the light on the tester comes on, the circuit is still hot.
Clip the wires at the switch once you have confirmed the power is off.
Strip the wires about 1/2 inch and attach them to the new motion-sensor switch.
Adjust the sensitivity of the motion sensor, including the interval between someone entering the room and the lights turning on and how long they will remain on after the person leaves the room. Follow the manufacturer's instructions for specific directions.
Place the wires back in the wall cavity and attach the switch fixture to the outlet using the screwdriver. Turn the power back on at the circuit breaker and test the sensor's response and adjust it accordingly, if necessary, after turning the power back off at the circuit breaker.
Replace the switch plate and screw it into the wall.