You have to determine in advance what area of sky the fireworks are detonating in and point your camera there. Also observe how long between some characteristic event like the initial fizz or appearance above the horizon and the maximum intensity or size of the explosion. When you see or hear a firework rising toward that area hit a long exposure (enough to cut off around the time the explosion maxes out) with an aperture for a good deep focus. Pref. cable release, tripod and (unless digital) autowinder.
More specific, technical advice here (once you get past the pseudo-patriotic b*ll*cks):
Fireworks Photography: Fireworks Photography Tips from New York Institute of Photography