How can I do the hatching shading technique properly?
What are hatching and cross-hatching?
This article from the Drawing Magazine explains the basic idea of hatching and cross-hatching:

At its most basic, hatching, also called hachure, refers to setting down a pattern of short, rhythmic, parallel lines close together and evenly spaced in order to darken a passage or increase the sense of form in a drawing. The initial “screen” of hatching may be overlaid with subsequent series of lines drawn at contrasting angles, creating crosshatching
and further darkening the value of the area.

... as well as what they can be used for in art:

The basic illusion of hatching is that a sequence of separate lines will read as a solid value from a slight distance. With hachure a draftsman can evoke a middle tone, a core or cast shadow or the atmosphere around a figure, as well as provide a means by which disparate elements of a drawing are unified.

Objectives, techniques, and variations
This online tutorial with pictures and videos tells you some of the basic techniques and variations of the art of hatching and cross-hatching. I'll provide some of the most useful quotes for introductory guidance.

Hatching

Hatching is created when non-crossing lines are used to indicate the value on or around an object. The value added to the object is dependent on the location of a light source. More marks are added in the areas of core shadow and cast shadow, while less marks should exist in lighter areas.
When hatching is used, the lines drawn generally go in the same direction and are mostly parallel with each other. Sometimes, the lines may curve slightly or even a great bit depending on the contours of the object. Lines of this nature are referred to as cross contour lines.
When used correctly, cross contour lines can further the illusion of form by giving the viewer information about the actual 3-dimensional qualities of the object.
By changing the frequency of the use of line, and the amount of space between the lines, the artist can create a full range of value in the drawing. Assuming that an artist is working on white paper, more space between the lines (more paper showing) will lead to lighter values in the drawing. Less space between lines will naturally lead to darker values in the drawing.


Cross hatching

When cross hatching is used, the artist may begin adding value as hatching, but then allow the lines to cross over each other. The more that the lines cross over each other, the darker the value becomes.
Many artists approach the addition of crossing lines as a science, following a specific order of vertical lines, followed by horizontal lines, followed by diagonal lines, and so on.
This method produces very deliberate and controlled marks that are very exact and precise. Others simply cross the lines at random leading to “looser” drawings. Neither way is better, per se. Some looser approaches work better for some subjects, while more rigid approaches are suitable for other subjects.



For a more visual way of learning how to do hatching and cross-hatching, there are various tutorial videos online. Here's one using a calligraphic pen and ink:
https://www.youtube.com/watch?v=AHoqh27vQRw
And another one using a pencil:
https://www.youtube.com/watch?v=HxZwO_tIpns