When shooting with flash, your camera will set the exposure, i.e. aperture, exposure time, ISO, differently than without. Especially for the exposure time there are different rules.
The exposure made up of aperture, exposure time and ISO determines the brightness at a greater distance, where the flash does not reach. The shorter the distance to the camera and the weaker the ambient light, the more the flash light dominates.
There are no restrictions on choosing aperture and ISO sensitivity when photographing with flash, as long as they do not limit the range of the flash. If you close the aperture further, less light reaches the sensor and the flash should shine brighter. It's the same with ISO sensitivity.
Exposure time has some special features when photographing with flash.
The flash sync speed is the shortest exposure time your camera can achieve when shooting with flash and without any special technical tricks.
This is a technical limitation, relevant e.g. if you want to lighten shadows with the flash in bright sunlight. But there is a technical trick to get around this; I will go into it below.
In camera mode S/Tv or M, the camera will not allow a shutter speed faster than the flash sync speed when a flash is on.
Smartphones do not use flash but a continuous light, there is no limitation there.
The longest exposure time with flash is usually limited to 1⁄60 s, possibly 1⁄30 s if you do not actively intervene. This is a common behaviour to protect against camera shake, there is no technical limit enforcing it. Usually you switch on the flash when it gets too dark to take blur-free photos, then limiting the exposure time makes sense.
If you use the camera mode S resp. Tv or M, the camera will use a manually set slow shutter speed. But then you will get exactly the time you have chosen, not one adjusted to the actual background brightness by exposure metering.
This is a technical trick to help cameras with a long flash sync time of e.g. 1⁄250 s to achieve shorter exposure times. Nikon calls this FP short-time synchronisation, Canon and Sony high-speed synchronisation, or HSS.
In simple terms, the flash then emits a rapid sequence of several flashes, which reduces the range. But apart from that, you can then shoot with flash at any short exposure times - if your flash supports this function and you have switched it on in the camera menus.
Programmed auto P
Shutter priority S resp. Tv | If you are shooting with an SLR or mirrorless system camera, you will not be able to set an exposure time shorter than the flash sync speed of probably 1⁄250 s – unless you have switched on high speed synchronisation.
Aperture priority A resp. Av | You can use this camera mode as without flash. Remember, however, that a small aperture reduces the flash range.
Manual control M | You can also use the manual mode in the same way as when taking pictures without flash. The automatic control of the flash brightness also works in manual mode M.
With flash, manual control is quite useful, e.g. when photographing an evening event: with an aperture of e.g. 4 or 5.6 for some depth of field and a fixed exposure time of e.g. 1⁄15 s, you can provide brightness in the background without the exposure times becoming unpleasantly long. And the people in the foreground are taken care of by the camera's automatic flash exposure.
ISO sensitivity | You can set the ISO sensitivity in the same way as when taking photos without flash – with a fixed value or the ISO automatic. Note, however, that in darkness the auto ISO may push the ISO sensitivity to the highest value. If you prefer shooting your main subject at a lower ISO sensitivity for less noise, turn it off.