Shooting with flash is a bit different to shooting with out flash. The key part of determining any flash exposure is the lens’ aperture, the camera ISO, and the power out put of your flash. The exposure happens when the flash fires and your shutter needs to be open for the duration of the flash.
The duration of the flash from electronic flash units is quite short, about 1/1000th of a second or even faster is not uncommon. The exposure is made while the shutter is open, and the flash fires. Your cameras shutter speed will be slower that the flashes there for you freeze that moment in time. In short the shutter opens, the flash fires, and the shutter closes. The amount of light that get through to your chip (or film) is determined by the power of the flash and the F/ (aperture) used. Finally the ISO settings of your camera will determine how much of that light it keeps or can use.
If you are shooting at a higher shutter speed than your camera can synchronise at you will only get part of the picture. What part is missing depends on which way the shutter travels and how much you get is determined by the shutter speed you selected. If your shutter speed is set way to fast you will only get a black frame, if your sync speed is set only slightly to fast you will get a black stripe on the side of your photo. Modern DSLR cameras have maximum synchronization speed that varies with each camera so please look at your cameras hand book to find out the maximum sync speed (or X speed)
There are several different affects you can achieve by adjusting your sync speed. Lower shutter speeds allow more of the ambient light to influence overall exposure, mostly the background (because the aperture you select determines the main subject’s exposure). Using a slow shutter speed can "open up" the background allowing more ambient light to affect the exposure and show more separation between subject and background.
But be aware that the colour temperature of any artificial lights in the ambient light. Depending on how bright they may be, using slower shutter speeds can add unwanted colour that may pollute skin tones in your shot. The solution: Increase shutter speed but not too much. On the other hand, warmer light sources can add pleasant warmth to the photographs.
A faster exposure speed will generally result in a sharper image due to less movement during the exposure. It will also isolate the subject more from any back ground as less ambient light will be captured in the exposure.