Identify which of the two wire's supplying the device is the hot wire. This is typically the black wire in home electrical and the red within automotive electrical. You can also use a non-contact voltage detector to identify which wire is carrying electricity by touching the tip of the detector to each wire.
Turn the power off for the device at the source. This may be unplugging it from the outlet or turning the breaker off at the electrical panel. Confirm the power is off by touching a non-contact voltage detector to the wire's insulation.
Cut the hot wire with wire cutters in the location you want to install the switch.
Strip 3/8 inches of insulation off the end of each cut wire with wire strippers.
Twist together one of the black wires from the pull chain switch with one of the hot wires for the device with pliers. Install a twist-on wire connector on top and wrap the connection in electrical tape to provide additional protection.
Twist together the other black wire from the pull chain switch with the remaining hot wire on the device. Install a twist-on wire connector on top and wrap the connection in electrical tape to provide additional protection.