Based on your description it is very likely that either the red wire or black wire is switched and the other is on all the time. In most cases the light of the fan, if it has a light, is connected to the switched wire and the fan is connected to the unswitched wire. This allows you to turn off the light while allowing the fan to remain running. There is no way to know without testing which wire is switched.
The white wire is the neutral, connected to the white, or neutral, or common conductor of the fixture. There should also be a bare or green wire in the box to connect to the ground wire of the fixture.
Chat with our AI personalities
If both wires are black, the one that connects to your white wire is the one that should have little writing on it. Black to the plain black wire, white to the wire with writing.
just did one. Cut the three wires and remove it. Then join the black to the red and the white to the white. Thats all it takes
Assuming the wires are the correct gauge for application and breaker you use black and white wires as hot. Put red electrical tape on each end of white wire and connect red and black to the breaker output and bare wire to ground lug in panel. At receptacle connect black and red to hot contacts and bare wire to ground lug.
If both wires are black then the one with the writing is the neutral wire. If the two wires are black and white then the white one is the neutral.
Black/White/Ground power in and the same out. Tie the incoming and outgoing white wires together under a yellow wire nut and push them back in the box. Tie the ground wires together under a green wire nut and connect the pigtail from those ground wires to the ground screw on the switch. Connect the 2 black wires you have left to the 2 screws on the switch. Doesn't matter which black wire you connect to which screw.