How to do long exposure photography on my nikon d3000?

I think I have to use the M function, but I don't know how to make it so the lights look traced in the usual long exposure style

First read the instructions that came with your camera, then read a basic photography book.

For long exposures, you want to have a longer shutter speed of a few seconds. Check you manual or online on how to change it on your camera.
If you want to have those light trails, just have a tripod and a long shutter speed. If you are unsure of how to use your camera on manual function, just use shutter priority. You choose the shutter speed and the camera will choose the aperture so you don't have to worry about it.
Here's a video.