The opening you are going to patch may be of any geometric shape such as oval, circle, rectangle etc. Your work will be easier if the opening was square in shape. Draw a square around the opening-to-be-patched using a speed square.
Cut on the boundaries of the square you just drew. Use a drywall knife for the job. When you are done, the hole you are going to fill will be a perfect square and now it will be a lot easier for you to patch it.
Image Courtesy: icreatables.com
Measure the dimensions of the opening using the speed square.
Take a piece of scrap drywall which is bigger than the opening you are going to patch. Transfer the measurements you took in the earlier step to the piece of scrap drywall that will serve as the patch. Cut the patch leaving around 2 inches of drywall on each side of the measurements.
Get rid of the excess drywall that you left in the previous step but make sure that you do not remove the drywall paper on one side of the patch. Use a chisel for the job if necessary to ensure that the drywall paper does not gets torn away.
Apply drywall mud to the sides of the square opening.
Fit the patch in the opening. Cover the patch with joint compound extending the layer at least a couple of inches on all sides of the patch. Let the joint compound dry. If the surface is not level, apply another layer of joint compound and give it time to dry.
Image Courtesy: diyguides.dremel.com
Sand the joint compound using fine sandpaper and finally paint the area to finish off the task.