Definition
A grainline is the straight arrow printed on a pattern piece that must be placed parallel to the selvedge, so the piece is cut on the lengthwise grain.
The grainline tells you how a pattern piece sits on the fabric. Woven fabric has a lengthwise grain (the warp threads, parallel to the selvedge), a crosswise grain (the weft threads, from selvedge to selvedge) and the bias at 45 degrees. Each direction stretches and hangs differently, so the arrow decides how the finished garment behaves.
To place a piece on grain, measure from one end of the arrow to the selvedge, then from the other end, and shift the piece until both distances match. A piece only a few degrees off can make side seams twist toward the front, trouser legs spiral and hems hang unevenly, especially after washing. Knits are equally sensitive: keep the arrow parallel to the ribs, the vertical columns of stitches.
Most grainlines have arrowheads at both ends, meaning the piece can be turned 180 degrees. A single arrowhead, or a note such as "with nap", means every piece must point the same way. An arrow drawn at 45 degrees to the edge of the piece means it is cut on the bias.
For the full method, from folding the fabric to checking each piece, see laying out and cutting fabric on grain.