Blurry photos are generally a bad thing. But although it’s true that—with rare exception—no one likes camera shake in their photos, sometimes blur is intentional, such as when you shoot a photo with shallow depth of field so that the subject is sharp and the background is out of focus.
Within the blurry background, you often have lights or reflections—especially at night. In fact, the quality of the background on those highlights is something that photographers consider when taking the shot, and you can affect the look of your photo by tweaking that blurriness. There’s even a name for this effect—it’s called bokeh, and it comes from a Japanese word meaning “blur” or “haze.” Here’s what I’m talking about; consider this detail from the background of a photo.

In a nutshell, bokeh refers to the visual properties of blur. But before I go any further, first, some simple science: Where are the blurry dots coming from? Without getting too technical, I can say that bokeh happens when light rays pass through the camera lens and diffract around the lens aperture. As a result, the shape of the aperture gets repeated all over the background of the image. Often, the blur is not quite round, because the aperture isn’t perfectly round; typically it’s made from seven or nine metal blades—small metal surfaces that open and close inside the lens like a diaphragm—that approximate a circle. But if the aperture is shot wide open at the smallest f-number, then the blur will be a perfect circle.

So how do you shoot to get this effect? The most important thing you need is a scene that includes fairly small lights or reflections. The lights of a city at night, Christmas tree lights, or bits of light reflecting off leaves are all good candidates. Large lights or reflective surfaces won’t work if you shoot them too close.
Once you have the lights, you need to shoot them with the right settings. To bring out their inner bokeh, you have to keep them out of focus, so make them the background element in your shot. The more distance you can put between your subject and the background lights, the better the bokeh may be.
Finally, you need a relatively large aperture (small f-number). Switch your camera to aperture priority and dial in the biggest aperture you can. Unfortunately, this is where a lot of less expensive lenses and smartphones fail to measure up, because you want to be able to open the lens significantly—to f/3.5, f/2.8, or even f/2 if the lens can go that wide. Generally, the wider the better.
How lenses affect bokeh
The same scene taken by two different lenses can look quite different. Consider, for example, the difference between a five-bladed lens and a nine-bladed lens. You can clearly see the difference in the shape of the lights in the examples below.

The bokeh you get from lenses with fewer blades can have a more geometric look, and that’s why some photographers go out of their way to use specific lenses for a certain bokeh. Inexpensive five-bladed lenses, for example, tend to give you lots of blurry pentagrams. And check out this crazy bokeh, which looks like a bunch of tiny donuts:

To get this particular look, you need a special kind of lens called a catadioptric lens—it’s essentially a mirror telescope. The hollow center in the bokeh is a result of the small secondary mirror in the lens that reflects light from the main mirror into the camera sensor.