How to replace bathroom fan?
If you have to do this from below then you need to remove a large section of drywall such that you can secure the metal housing for the fan to supports.  Once you need to cut a large section of drywall you might as well mark the joists and cut back to 1/2 the width of the closest joist and remove from one joist to the other, for the other dimension whatever makes sense and add some nailing edges.

Ultimately you'll need to tape, mud, sand 4 edges and buy a full sheet of drywall.  A little extra length to the taping isn't going to change much.  You'll also need to paint for this kind of thing you might as well paint the whole ceiling.

Since you've indicated there is an attic above depending on your climate you'll have to patch or install vapor barrier and do a good air sealing especially in a bathroom.