It starts before you harvest them. Withdraw water about two weeks before harvesting. Some years Nature intervenes in this, and those years are the hardest to overwinter the onions.... but keep water off them as much as possible before harvest.
Next, dry the onions in full sun until the tops are obviously no longer bright green. Here that takes a day or less if the onions are in good shape, longer if they have had recent water.
Next, remove the tops and most of the roots without cutting into the onion bulb, place them stem up on elevated bed of hardware cloth, chicken wire or anything perforated so air can circulate. The bed should be located in a dark but open-ended shed which enables air circulation. I add a fan to mine 24/7 to aid air circulation.
No touching...onions should not touch each other in storage. No washing ever until you are ready to eat.
I like to hand squeeze my bulbs after sun drying and before storing to eliminate any/all soft ones. The soft ones will fail and take others out with them in storage. The hard, firm onions are what you want. Eat any soft ones first.
Don't fall for the BS about sweet onions failing to store. I grow the sweetest onion on Earth and store it from May to News Years Day if it isn't eaten first. Thanksgiving dinner is always with garden onions as is Christmas dinner around here. New Years Day sometimes we run out but never because of failed storage...they are that good to eat!!
I always start my crop in Oct. and harvest in the following May. That provides us fresh green onions starting in Jan. about when the stored onion bulbs from the previous season have all been eaten. No store-bought onions here is my standing goal...and it has been achieved most of the time for decades.
I'm inside for the night just now but if you or anyone is interested, I will post photo of this year's crop in storage tomorrow.