Click to start a polyline at a point; shift + click to continue from that point. Press Z to remove the last point, and press enter to complete the polygon. Space will clear everything.
Middle click (or ctrl/command + click) to set the anchor position.