The answer to 'how to install switch' is to first turn off the power to the circuit at the circuit breaker. Then, remove the old switch and disconnect the wires. Attach the new switch by connecting the wires according to the manufacturer's instructions, typically matching the colors. Finally, secure the switch in the wall and turn the power back on to test it.
Installing a new light switch is a relatively simple DIY project, but it's important to take safety precautions and turn off the power before working on any electrical components. If you're not comfortable working with electricity, it's best to hire a licensed electrician to handle the installation.