Pull your onions up on a sunny day if you can, then let them sit in the sun for another day or so to dry (in hot climates this usually takes just a few hours). This drying kills the root system at the bottom of each bulb. The roots will be like little brittle wires when they're dry.
Picking the right day to pull the onions can determine how well the onions will keep. If you harvest them after some rainy weather they'll have a lot more moisture in them and won't dry out as well.
After drying the onions in the open for a day or so, it's time to bring them under cover for a second, longer drying or "curing" process.
Some people cut the tops off the onions before curing, but that's not strictly necessary. However, if you do trim the top leaves, don't cut them any closer than one inch from the bulb. Otherwise the neck won't dry out, and the onion could rot in storage.
To cure the onions, spread them out in any warm, airy place out of the sun, such as on a porch. If you find you have too many onions for your available porch space, try spreading them out near the edge of your driveway, covering them with a light cotton (not plastic) sheet to provide shade. The sheet, held in place by stones along the edge, keeps the sun from burning the bulbs but still allows a lot of air circulation. Turn the bulbs a couple of times to promote even drying.