If you are getting them from your garden, or with the papery outer skin on, do not wash them! Just rub the dirt off, or, at most, wipe them gently with a damp towel, and keep the tops and tails on. If the outer skin is removed, just wipe them down.
This is the part where you get to be creative. You also have to be able to braid. You basically braid the tops, adding an onion in a layer, about 4-5 all together, and then tie the braids up in something sturdy.
Once the onions are dried on the outside, (the inside will remain moist, but onions are astringent enough that they are usually fine) I cut them down, leaving about a 1/2 inch of the stem, and put them in a paper bag with wood chips (I have a bunny, so the pine bedding from the pet store works fine) and put them in a wicker basket, and keep them in the pantry in the basement. The area does need to remain dry, so I do have a dehumidifier down there during the summer months. If you need an onion while they are hanging, just cut one off at the stem! When you do dry onions, before you use one, check its firmness. If done right, an onion will remain firm for months. If you do get one that is soft, remove it quickly to avoid ruining your whole bag. When using it, peel it like you would a fresh onion, and just check for anything weird. Very rarely have I had to toss an onion, but it is always better to be safe and check, then to be sorry and sick.