This sample shows how to create a custom drawing tool for polygons. Press the "Draw Polygon" then start selecting points on the map. When you are done, either click on the first point of the polygon or press ESC.
For a more robust, out of the box solution, use the
Drawing tools module