It's often difficult to get good results with your flash. The subject is usually badly overexposed and the background is black. To make matters worse, the dreaded red-eye makes your subject look like something from a bad horror flick. A wee bit of science will help us understand what's happening and how to fix it.
The physics guys will tell you that light diminishes in intensity as the square of the distance from the source. That means that a subject ten feet from your flash will receive four times more light than the subject twenty feet away. This is why flash cameras in football stadiums are somewhat ineffective. In short, if we properly expose Uncle Harry the house behind him will be two f/stops under-exposed. When the Sun is our light source difference in distance between Henry and the house is minor compared to the distance to the Sun, so we don't have the problem.
The red-eye problem is also explained by the physics of light. The retina of our eyes is very reflective and, as it turns out, red. Red-eye occurs when the light from your flash enters the eye and bounces back to the camera. Cats and dogs have green retinas, so they get green-eye.
Now that we understand the causes, let's see if we can find some ways to make our flash pictures better.
One solution to the dark background problem is to use the available light to light the background and only use the flash to bring out the subject. This is commonly called fill-flash. With fill-flash we set the flash to a low enough power setting that it doesn't drop the background into black. I often use fill-flash when shooting on bright sunny days. It helps reduce the contrast between the shadows and highlights. When shooting into the sun, the flash will illuminate the subject so I don't get a silhouette.
Most of the newer cameras will do fill-flash automatically. It's not difficult to do manually. Simply meter and expose as you would without flash. Set the flash to one f/stop smaller (bigger number) than you set the lens. The flash will emit half the light needed to fully illuminate the subject, just enough to lighten up the shadows.
Increasing the distance between the flash and the subject is usually helpful, at least to a point. It reduces the difference in light between the subject and the background. Likewise decreasing the distance between the subject and the background helps illuminate them more evenly. Watch out though, if you paste your subject up against a wall you will get some ugly black shadows.
You can minimize the wall shadows by getting the flash above the camera by four inches or so. The shadows will be there, but the camera won't see them because they will be lower behind the subject.
Getting the flash up in the air also fixes the red-eye problem. Because the light from the flash is traveling down slightly, relative to the lens, the reflection will tend to hit below the lens. Some flashes have "red-eye reduction" this is usually implemented as a pre-flash that is supposed to cause the subjects pupils to close a little reducing the reflection from the retina. I find that the biggest effect is that people think the pre-flash is the shot and turn their heads or close their eyes.
On-camera flashes are usually not far enough above the lens to eliminate red-eye.
The add-on flash units that you can buy usually mount so that the flash is above the lens by four or five inches. That's enough so that they will have much better red-eye performance than the flash built into the camera. They also have a feature that allows you to bounce the flash off the ceiling or wall. The idea is to soften the light by spreading it over a larger area. I have mixed results with bouncing. Often the ceiling is not white or too high and the light coming down from there can leave some funny shadows on faces. If you have such a flash I encourage you to experiment with the bouncing, you might like it better than I do.
I use a mini-softbox on my flash. A softbox looks like a tent, the strobe is attached to the top, pointing into the tent, and the tent's bottom is aimed at the subject. The light from the strobe passes through one or more layers of white cloth giving it a very soft quality that flatters the face. A mini-softbox is a very small softbox that attaches to the flash to diffuse and soften its light. Mine is quite simple a few pieces of soft plastic and some Velcro.
If you take a lot of flash pictures you will want a gadget called a flash bracket. The one I have is called a flip-flash. The camera is attached to the bottom of the frame via the tripod socket, the flash is mounted on an arm that curves back over the top of the camera. You will need a cord that connects the flash to the camera. Mine connects to the hot shoe. The flash bracket has two big advantages. First, it gets the flash up in the air and off the camera. This almost totally eliminates the red-eye problem. It also reduces the shadows that normally appear behind the subject. Second, when shooting vertical shots you can flip the flash over so that it's still above the camera. This eliminates the weird shadows you see to the side of the subject when the shot is vertical.