I'm trying to make a lamppost with a curved metal (like in the picture) and I don't know how to make the curved bit on top.
Alternatively (to my other answer), you could model the whole lamp shape from a curve. Just hit Shift+A > Curve > Bezier. Then give the curve some thickness by setting the bevel to something other than
0 and setting the fill to full under the data properties panel.
In edit mode you can Ctrl + Click to add new control points and use Alt+S to adjust the relative bevel thickness of the control points to create a shape like this.
Once you have the basic curvature down you can convert the curve to a mesh with Alt+C > Mesh From Curve and model the finer details.
I would use the spin tool. Spin extrudes a portion of geometry along a radial curve (portion of a circle). Just place the 3D cursor at the center of the curve, be sure you are in side view (NumPad 3) or else the direction of extrusion will be strange, select the top ring of the straight part, and hit Alt+R. Then hit F6 and you can tweak the settings to get the curve you want.
You can adjust the curve angle with the angle spinner and the resolution of the extrusion with the steps spinner. You can also adjust the center of the curve (by default this is set to the location of the 3D cursor), and the axis (as a vector) around which to rotate the extrusion (by default this is perpendicular to the view plane).