Roughly speaking, the flash itself is instantaneous (typical electronic flash durations are 1/1000 to as short as 1/100,000 second).
Because the flash is so brief, it illuminates only the part of the sensor that is exposed to light at the moment it fires. The shutter must open fully, exposing the entire sensor; then the flash must fire before the shutter starts to close.
Focal-plane shutters get their higher speeds by moving a slit across the sensor. Above the X_sync speed, there is a never a time when the entire sensor is exposed.
Some flashes have a "high-speed sync" mode in which the flash fires several times as the slit moves, so that you wind up with even flashes across the sense. This feature isn't normally very useful, though.
Turning for a moment to history, old bulb flashes for one-time use took a long time from when they were fired (literally, ignited) until maximum light output. To keep up with Curtis N's famous maxim of having the flash go off while the shutter is open, they actually had to fire the flash before the shutter started moving. You'd have perhaps 1/10 of a second in which the flash reached full output, followed by a 1/60 exposure with essentially constant flash output. Then you'd thrown the bulb away with no concern for the fact that it was toxic waste. 