As Jamie says, with flash there are two exposures - one for the ambient light, and one for the flash.
With normal flash, flash exposure is controlled by the power output - and also the f/number and ISO, but
not the shutter speed. (High Speed Sync mode is different, leaving that aside for now.)
The ambient exposure is controlled by all three factors - f/number, ISO and also the shutter speed. But
not the flash power output, as this only affects the foreground (flash illumination falls off very quickly over distance).
In this way it is possible to regulate the balance between the flash and ambient light, using the power output to adjust the flash (without affecting the ambient background) and the shutter speed to regulate the ambient light (without affecting the flash).
With Canon, using any of the camera's auto modes on E-TTL, the camera will generally attempt to balance both the flash and ambient exposures, although there are differences. On Tv, the camera will increase/reduce the f/number as far as it can, but it soon runs out of adjustment. On Av, the camera will let the shutter speed run as long as it needs to balance the flash, possibly up to several seconds. Using P, the camera will only let the shutter speed drop to 1/60sec to balance the ambient light, working on the assumption that it's better to let the background go dark rather than risk subject movement bluring the background.
Av therefore gives you most scope, and you can adjust the balance between the flash and ambient light ratios with +/- compensation on the camera to lighten/darken the background (by altering the shutter speed) and +/- compensation on the gun to lighten/darken the flash (by altering the power).
Edit: going back to High Speed Sync, when you're in Av and the camera is adjusting the shutter speed to balance the ambient light, if you're shooting in bright light, eg using fill-in flash, the shutter speed will quite often want to run faster than 1/250sec. That's when you use HSS, which increases the duration of the flash so it is long enough to cover the full cycle of the focal plane shutter, so you can use any shutter speed, right up to 1/8000. Just switch it on, that's all there is to it. The drawback is that HSS uses a great deal of flash power, even though most of it is inevitably wasted by the way the shutter has to operate, but it's fine when you're close - like maybe ten feet away or less, it varies of course. It's a fantastic feature, and daylight fill-in makes for great pictures. I seem to use it all the time
