you will have to take the fan down. take the wires out by pushing in a real small screw driver where you see the wires. They come right out. Look at the switch before you remove the wires and right down what color corresponds with the marking (number or letter) on the switch, that way it’s easier to put back on. take the old switch with you so you get the same one.. you can get the switch at Home Depot or most home improvement stores.
good luck