When choosing a new exhaust fan, measure the room and match the fan size by rating in cubic feet per minute. Select the appropriate-sized fan, and begin installation.
For better results, choose a fan rated for a larger room, and remember to consider the fan's sound level; fans are also rated by how noisy they are.
Turn off the power at the electrical panel. Remove the nails holding the existing fan in place
Disconnect the vent pipe from the old exhaust fan in the attic.
Disconnect the wires on the old exhaust fan from the main electrical feed. The new fan will be connected to that same feed.
Always follow manufacturer's installation instructions.
After removing the old fan, run the electrical cable into the new housing, making sure to match up each wire: white with white, black with black, green with ground, etc. Twist the wires together and secure with wire nuts. Secure the cables in the fan housing and set in place into the ceiling from above.
Mount the housing to the framing in the attic using screws.
Reattach the vent pipe in the attic; then snap the fan motor in place from below.
Plug in the fan and replace the new vent cover. Turn the power back on and test the fan.