Let's organize this a bit more.
When you are using flash you are adding one more variable into the equation.
Without it, exposure is governed by aperture, shutter speed and ISO.
With flash, exposure is governed by aperture, shutter speed, ISO AND flash light intensity.
Flash light intensity received by the sensor is not influenced by the shutter speed.
Flash fires for about 1/10000 of a second and the sensor get's it all with any shutter speed.
So shutter speed will only influence the ambient light.
Aperture , by restricting the ALL the light that reaches the sensor, influences both ambient light and flash light intensity.
Flash light intensity alone may be adjusted by flash power and/or flash distance to the subject.
All the above give you the flexibility to differentiate your exposure for flash light and ambient light (or subject and background) as you need.
First you have to know exposure for ambient light. That's simple, with the flash off, take a measurement of your scene, then adjust aperture, shutter speed and ISO for correct exposure and the type of scene that you have, moving , static , portrait group and so on. Basically, you meter and set exposure for the background.
Second, set the flash. You have 2 options:
A. Automatic (TTL) . In this mode, flash exposure is set by a preflash fired with the shutter closed, light is measured in the CENTER of the frame and then the camera takes the picture with the manual settings you have chosen, and the exact amount of flash power for correct exposure in the CENTER of the frame, according to the aperture you have chosen in the previous step, and distance to the subject (the CENTER of the frame)
I have lied to you in the previous paragraph; you can't exactly choose ANY shutter speed. There is a limit. It's called sync speed, and it's specific to the camera. It may be from B(bulb) to 1/200, 1/250 or even 1/500. It's in the camera manual. I didn't quite lie though, because you can put the flash in high speed mode and then you really may choose any shutter speed, but, the maximum power of the flash is much lower, and , if you do that in rapid succession many times, you may toast the flash.
B. Manual. In this mode you chose the flash power you want. With the digital camera you have the luxury to see exactly what you're doing, so a little trial and error will take you quickly to the results you seek.
Now, what results do you seek?
If you are in broad daylight, around noon on a sunny day, you can't overpower sunlight with the flash, even with shutter speed at its shortest (sync speed) and aperture closed. So your main light will be the sunlight and the flash will be used to fill in deep shadows on your subject. This is the best use of TTL; it does a great job in this situation.
The back light situation; in this one, expose correctly for the background and use flash to illuminate the subject. At this, in my opinion, TTL doesn't do such a great job, your subject will be illuminated but , always too much, and will look like a glowing Martian on a vacation.
Best, in this case, use manual flash to have a more balanced result.
Dawn or dusk change the situation and, selecting shorter shutter speeds, you can diminish ambient light until you shut it down completely. This gives you maximum flexibility because you can choose which one is your main light, flash or sun, and the balance between them.
At night, your main light will be the flash and ambient light, if you expose enough, will be dim.
Indoors works pretty much on the same principle, but a new problem arises, the light source type. If it is daylight through windows, it's OK. If it's incandescent (tungsten) or fluorescent, then there is a color conflict between those, and the flash light that has a color close to daylight. If the problem is not addressed, your subject may have the correct color but the background will be an orange yellow or an undead green. No Photoshop will correct this one automatically, one has to work hard to do it so you're better off spending $20 or so and getting flash filters (gels) that will color its light like tungsten or fluorescent light, and setting the WB accordingly, you have no color problems.
I really hope this one is clearer than the previous post.
Canon PowerShot S100
Canon 50D , SIGMA 10-20 f3.5 ,Canon EF 24-105 L IS USM, Canon EF 100/2.8 macro Canon EF 50/1.4 ,Canon EF 85 f1.8,Canon EF-S17-85 4-5.6 Old Tamron 28-300 inherited from my Canon Rebel G film camera