The 'secret' to repairing a tear in a canvas is to do it from the back of the canvas, not the front. What you need to do is carefully align the threads in the tear, then stick another bit of fabric on the back to hold it in place. The hard part is doing it neatly and getting everything to lie flat.
Cut a Piece of Canvas
Cut a piece of canvas that is at least an inch wider than the tear all around. You may want to cut the corners rounded to prevent them from lifting up. You could use heavyweight paper, but it's not as strong or flexible as fabric. If you haven't got a bit of canvas, any bit of light-colored fabric will do the job, but it shouldn't be too thin. Don't skimp and cut a narrow repair strip, as you don't want to add strain on the fibers in the canvas near the tear.
Lay the painting face-down on a clean surface. Use an acid-free glue ("white" craft glue) to adhere the repair fabric. A primer such as acrylic gesso or a medium such as matte or gel medium also works well as glue. Apply a thin, even layer of glue, gesso, or medium to the patch and place it over the tear. If the tear is underneath the stretcher bars you might want to use a spatula to put the repair fabric in place. Avoid the temptation to apply too much glue; it will simply squeeze out the edges and create a mess. A small piece of cardboard or plastic credit card works well to spread the glue or medium over the surface of the fabric.
Turn the canvas over so that it is facing right side up, placing a book underneath the patch that is the same height as the stretcher bars so that the canvas is supported at the site of the tear. (Place some thick paper or card under the patch to protect the book from any glue.)
Put Loose Threads Into Place
Check the alignment of the edges of the tear. While the glue is still wet, push any loose threads into place as much as you can with something small such as a pair of tweezers, needle, fine scissors, or toothpick. You may not be able to get every bit of thread neatly arranged; those you can cut off when the glue has dried. Try to avoid getting glue on the front of the canvas. Put a bit of paper or thin card over it, then place another book on top of the repair and leave it flat to dry. You can also turn the canvas over so that it is face down and put a book on the site of the repair to flatten it while it dries.
Paint Your Repaired Canvas
When the glue is dry, the canvas is ready for painting. If the canvas is still blank, you can try to hide the tear under some additional gesso or medium. Even if the canvas is already painted, you can use a small brush to try to add some additional gesso or medium to the tear on the front of the painting to bring the surface up to the level of the original canvas. You may need a few layers.
Once the medium has dried, you may want to gently sand it. Then, using the same medium as the original painting, carefully match the colors of the original. It is easier to do this if you use a very small brush. Load the brush with the color that you have mixed and hold it up close to the painting to see if it matches the original color. Make sure to also match the texture of the original painting. If it is a very textural painting you have the advantage of hiding the tear with an impasto texture in the painting. You can also collage over the site of the repair if you are doing a collage and mixed-media piece.
If you are selling or giving a painting to a dealer to sell that you have repaired, you may want to let the buyer or dealer know that you have made a patch repair to the canvas, and perhaps offer a discount.
Note: If it is a tear in a valuable finished painting, it is worth getting an expert conservator to do a more refined repair, which may involve lining (adhering) the entire painting onto a new supporting canvas.