I have installed multi port exhaust fan in the attic to serve 3 separate bathrooms. How can I wire the fan so that the fan can operate independently from a switch in any of the bathrooms?
The answer to your question depends on many exact details of your existing circumstances. Are you building anew, or are you modifying an existing construction? If modifying, do you have access to run new cables? Is power supplied at the fan location or must you draw power from one of the bathrooms?
The following diagram assumes power supplied at the fan location. In general, the wiring for such a shared fan should look something like this:
The idea is to distribute the always-hot from the service panel to all the switches, then collect the switched-hots and connect them to the hot side of the load. The neutral side of the load is connected to the neutral from the service panel.
The name for this kind of circuit is "multiple parallel switch loops".
If power is to be take from one of the switch locations, the circuit becomes slightly more complicated:
But the principle is the same -- always-hot to all the switches, switched-hots in parallel to the load, neutral to the load.
In any case, in most places, your electric code now requires neutral to be distributed to all switch locations.