Quite intimidating task at first glance, but it's actually not difficult. I'll try to describe the most common triple-crossed setup of 36 spokes.
We start with the following pile of parts:
Holes in the rim are zigzag rather than in line:
Left side spokes go to the holes closer to left side of the rim and right spokes to right holes, of course.
Holes in the hub flanges are not mirrored, they are offset by half their pitch. It is clearly visible on this big hub:
The holes are closer together on smaller hubs, but their relative position is always the same. Stick first spoke from the outside through any hole, as on the picture above. Install the remaining eight spokes on this side the same way, skipping one hole on the hub and three on the rim:
A drop of oil on the threads makes screwing easier, especially with reused nipples.
Continue with the other side, inserting the spokes from the outside again. Place the first one next to some other spoke on the first side:
Continue installing the spokes, skipping holes as on the first side (one of the three holes to skip on the rim is already occupied, but don't let that confuse you). You should now get this:
Now change the temporary radial lacing to a proper tangential one. Turn the hub as far as you can. Which direction? Best is to tilt the spoke next to the valve hole away from it:
The point is to get more space for a pump. Sometimes it can be quite a problem, especially with smaller wheels.
Now the fun part begins. Insert another spoke into some hole, this time from the inside. Lift it to vertical position and turn agains the direction of the other spokes: over first, over second, under third, skip one hole after it and here you go:
Crossing under the third spoke is not trivial, the new spoke needs to be bent a little to clear the rim. Be careful, just flex like a bow, don't bend it permanently! (Recently I disassembled a factory-made wheel to replace a hub. You wouldn't believe how the spokes curled when released from their nipples. Buying cheap finished wheels doesn't look like a good idea anymore.)
Continue the same way around the whole wheel until first side is complete:
Now do the same on the other side. Stick a spoke from inside, over first, over second, under third, skip a hole (occupied this time) and screw a nipple:
Continue spoking until you run out of spokes, nipples and holes (ideally all three items at the same time). The lacing is finished - easy, isn't it? Now comes the hard part:
Start by setting all nipples to some initial position, for example by aligning their end with the edge of spoke thread, bottom of the notch with spoke end, or something similar - do the same for all, the spokes should be slightly tight at the end. This is the moment of truth - if we find the spoke ends sticking out through the nipples or conversely holding just by a few thread turns, we have no choice but to dismantle the wheel again and go to a bike shop to exchange them for longer or shorter ones (it's a good idea to measure the exact difference before the disassembly).
Now fix the wheel into its fork, in the exact position you want to have it at the end (of course, special truing jigs exist, but they are usually used only by professionals who don't need to read this tutorial). Theoretically the wheel shouldn't be so crooked that it wouldn't turn, so let's spin it, enjoy the beautiful taco shape and start tightening.
First tighten the nipples uniformly by the same amounts - one turn, half turn etc.. Check spoke tension after each run and try to keep it equal for all of them. You don't need a tensiometer, just pluck the spokes like guitar strings and tune the whole wheel to the same note (the target pitch can be found on some existing good wheel). Caution: rear wheels are often asymmetric due to wide sprocket clusters, so the right side needs to be tighter.
The spokes are now more or less equally long and equally tight, but the rim keeps wobbling. The most tedious chore is about to begin. Start by rough alignment in the axial (left/right) direction because it's easier. How? Place your finger (or plastic tyre lever or other suitable object) next to the rim, bracing it against the fork. Spin the wheel and you feel where the bumps are. Alternate tightening and loosening of spokes in the particular area moves the rim to one side. Feel the rim from both sides to avoid "pushing" it too far in one direction. Then align the radial (up/down) direction. This is more difficult because the nipples need much more turning than for the axial direction. Tighten or loosen the nipples the same on both sides. Feel the rim from both top and bottom side to smooth out both "hills" and "valleys". Of course, if you tighten something, you must loosen something else to maintain uniform tension and avoid tearing the wheel apart.
Alternate axial truing, radial truing and tension tuning until you are satisfied with the shape of your wheel. Perfectionists like me reduce the wobble under one millimetre, others can live with two. The wider the tyres, the wider the tolerances. On the other hand, riding irregular ellipses is neither comfortable nor safe.
Spoke pattern is a three-dimensional geometric structure that can be split into triangles solvable by standard high school geometry:
If you are not fan of manual calculations, use this Excel sheet or this online calculator (both use the formula above):
The number calculated in previous paragraph is the theoretical distance between centrepoint of hub spoke hole to the inner surface of the rim. Real spoke must be a bit longer to reach through a rim hole and screw into a nipple. How big bit? The safest method is a real-world measurement again - see the picture on the left. Draw a mark anywhere on the spoke (pictured in red) and measure the distance from it to the end of the spoke (dimension A). Then stick the spoke through the rim and screw a nipple on it, stopping somewhere around the point where spoke end reaches bottom of screwdriver slot in the nipple's head (that simulates initial position before the start of final tightening). Settle the nipple in its hole and measure the distance between your mark and inner rim surface (dimension B). The difference K=A-B is our length correction. Add it to the previously calculated length l and you're done. Or modify the calculation if you like: instead of using inner rim diameter D, use "effective diameter" D+2K, the result will be pretty much the same. Effective rim diameter (ERD) is a frequently used term and some manufacturers publish it for their rims, but I have already seen an incorrect one, so it's better to measure it ourselves to be sure.
For the sake of completeness - this is how spoke length is measured: