Once I learned to take pictures like this, it has been the one thing I look forward to every year, ever since. I want to teach you how it works! It is called the focus shift technique. I learned it myself from here.
What you will need: DSLR Camera, Long Lens, & a tripod. {I use a Canon 50D with a 28-135mm lens}.
Tips: The trick is so get as close to the fireworks as you can, so using a long lens is best. (I zoom my 28-135mm all the way to 135mm to get as close as I can.
Use Manual Mode. Here are the settings I use: ISO 100, F/11, 4s. You can use 1-6 seconds for your shutter speed, I use 4 on almost all of mine.
Don't wiggle the tripod! It will 'shake' the fireworks. It was a windy night in the picture above...unfortunately.
Instead of having your camera on AF (auto focus), switch it to MF (manual focus). This is the fun part! While you are shooting a picture for 4 seconds or so, turn your focus ring from in-focus to out-of-focus or vice-versa to create a magical image of a firework. While your shutter is capturing light for 4 seconds, you are forcing the image to appear out of focus then in focus.
Go try it yourself! To see more of my images, go here.