Scrape off peeling or flaking paint or ceiling rot with a putty knife until you reach the good ceiling layer underneath. Get rid of all signs of rot to minimize the risk of rot reappearing in the future.
Apply liquid epoxy filler in the cavity left after you remove the rotted area. Follow the manufacturer's instructions because the application method could vary depending on the epoxy product you use. Level the epoxy so it is flush with the rest of the ceiling. Let the filler completely dry for the recommended period of time. When it dries, it will become a part of the ceiling.
Paint the repaired area with a paintbrush or a paint roller to match the color of the rest of the ceiling.
Remove the rotted area of the ceiling if it has rotted through and crumbled. Cut the rotted part of the ceiling one section at a time with a handsaw. This is easier than trying to remove it all in one piece. Remove all the rot to prevent any remnant from spreading.
Find the dimensions of the hole left in the ceiling with a tape measure.
Cut a piece of wood with a table saw to match the size and shape of the hole in the ceiling. You may be able to get a lumberyard or a millwork shop to cut this piece of wood for you.
Hold the replacement piece up in the ceiling opening to check that it is the correct size and shape.
Fasten the replacement piece of wood to the ceiling stud with a screw gun or a hammer and nails.
Fill the nail holes with wood putty and use a putty knife to level the surface.
Paint the ceiling with a paintbrush or paint roller to help the replacement wood piece blend with the rest of the ceiling.