I decided to replace an old bathroom exhaust fan that hadn't worked in years. When I first bought the house 11 years ago the fan did work via a switch in the bathroom. I removed the old one (same make as new one# and rewired it exactly as it was. When I turn the power to the fan on it worked BUT I can not turn it off at the switch.
There were 2 romex cables going into the fan box. Each of these cables have a black, white & bare wire in them. One of these cables had the white and black just wire nutted together with the ground #bare wire) just cut back to the romex covering. The other romex cable was actually tied to the fan wires, it had one white which was tied to the white fan wire and the black one was tied to the black fan wire and again the ground was just cut off to the plastic romex covering.
The light switches on and off fine.
The problem is in your switches. They must have been replaced at one tome and then reinstalled incorrectly. Take them apart and find the one that controls the fan. I can't tell you exactly how to do this with out seeing them but I'm 90% sure that is what happened. It should be a simple fix but you may want to call in an electrician if it gets too confusing. You will need a tester for this one.