How can I apply long exposure lighting effects to a road (ideally using Photoshop or Illustrator)? See the image below for an example.
How can this be achieved?
Assuming you're starting with a nice night photo of an empty road without any headlights...
I'd make vector drawing first, to draw several curves where the headlight trails should be. Have some of them start or end in random places - simulating where cars happened to be at the beginning or end of the long exposure. Use the photo as a reference, but don't include in the output. Draw white or lightly colored orangish/yellowish lines on a transparent layer. Give these lines a thickness, whatever is right for the photo - the size an average headlight should appear if it were on a car on the road. If the cars come from very far, perspective will make the headlights appear larger close up, so taper the thickness somehow. Save as PNG (whatever preserves alpha), same size as original image.
My example is bad in that simple straight lines are good, but of course curves would be more dramatic. Curves would be especially dramatic on a straight street, but let's not explore that today.
Then in Photoshop (actually I used GIMP so my terminology may be different) the original goes on the bottom layer, then the headlight trails image, then finally any buildings, trees, whatever obstructing the view of the headlights, isolated from the original photo.
(to make it obvious for illustration, the isolated car was made blue-violet)
So far, it looks terrible, but we have the right stack. Blur the headlights slightly - a few pixels at most. Set the opacity of the headlights layer to somewhere 30% - 50% maybe more. Use Addition compositing mode, not the default blending mode.
It'll still look fake due to being too uniform in brightness. Use an eraser gently make the headlight trails more transparent in places. They should be the least transparent (appearing brightest) where the cars are closest to heading toward the viewer - this effect shows nicely in your example photo.
You may want to duplicate the headlight layer, set it to 10-20% opacity, and blur it more - 10-20 px, or enough that adjacent trails start to overlap. This also is Addition not the normal blending mode.
As an artist, it's up to you to refine the image to look better. Variety in brightness, color (but close to white) Also, some subtle kinks or jiggles make them look real, but this is best dealt with when making the vector drawing.
I didn't mention tail lights yet, but of course the same procedure applies but make them red.
I don't know of any plug-in or built-in lighting effect or feature that can do all this automatically. But then, I don't keep up with new Photoshop paraphernalia.
Per the asker's request, here's a solution that can be done in Illustrator:
First place the picture in Illustrator and lock that layer. Then, with the pen tool make paths that are similar in shape to what you are looking for.
After you've made a few, you can star picking the colors you need. Unlock the layer with the picture, lock and hide the layer with the stroked you made and choose a color on the light path. Save these colors to your swatches and relock the picture, unhide and unlock the paths.
Select the paths. Make sure you have stroke color selected and select gradient (the middle button underneath the stroke and fill selectors)
Now, select each path individually and open your gradient tool. Make sure you put the color mode in RGB (I think it defaults to Greyscale) by clicking the dropdown in the upper right of the tool window and select RGB. Now select the fist color in the gradient tool and change it to the colors you saves to your swatches and start adjusting where they need to go on the slider. You may have to click the reverse button above it if your colors are backwards on the stroke.
Once you have as many as you want, you can thin out the stroke thickness if they seemed too much.
You should have something similar which you can then copy into Photoshop and create some glow effects and shadowing or anything else that Illustrator doesn't do as well as Photoshop.
Keep in mind that the pen tool which I used in this tutorial has a steep learning curve so it will take a lot of practice to get the lines right if you've never used the tool before. I suggest watching a few tutorials on YouTube before starting, just as a primer.
A major point to remember when doing light trails, which is exhibited on your example image, is that they are from car lights and so the road is affected as well as the lights themselves. Although the light emission itself draws the trail, the light is cast on the road.
You need to ensure you (on a layer underneath your trails) appear to 'light up' the road.
The trails can then sit on top of the lit-up road, giving you an extra degree of realism.
Another tip is to ensure that the trails also vary in size, brightness and slight offsets of colour. Think the difference between a truck, a car and a motorbike; a road would feature all of these, and if you are doing something similar to the example image, they could each be in any lane.
Colour variations stay with the bright, but some vehicles have a pure white light, some show a slight yellow tint, and others show a blue-ish tint. Vehicles travelling in the opposite direction have red lights as well, so keep this in mind. Indicators (turn signals) between lanes are orange!