You can set your flash (built-in or external speedlight) to fire during a long exposure. This is useful when you want to still see your background when using a flash (i.e. when you need to compensate for the inverse square law).
Depending on what you're going for, you have the choice of either front-curtain (AKA first curtain) sync or rear-curtain (AKA second curtain) sync.
Click HERE to see a super-cool slow-motion demonstration of how your front and rear curtain work.
See image below. Rear-curtain sync means the flash fires at the very end of a long exposure, thus freezing any moving elements in their "final" place.
These are two fantastic tutorials that show how to use this feature in the field. You must know how to set this and use it!
VIDEO TUTORIAL: Understanding Rear-Curtain Sync (7:17)
STUDENT EXAMPLES: