Smaller than 1/2 inch, just fill it in with spackling or sheet rock mud.
Larger than 2 inches, use the method of a board behind the patch.
I'll show you the method that I use. I like to use joint compound rather than spackling, but that is a choice for you. The pictures don't show the actual sheetrock mud, just the method used.
Step 1: Make the patch
Turn the patch over so that you see the back of it.
Use a drywall knife to cut a "tic-tac-toe" pattern on the back of the piece.
The center square should be larger than the hole you are repairing.
Bend the pieces away from you and remove each piece, leaving the center square intact.
Step 2: Fit the patch to the hole
Place it over the hole to repair and trace around the edges of the center piece.
Use a drywall knife and cut out the hole so that the patch fits into the hole.