Clean it, dry it completely, oil the blade, and store it somewhere with stable humidity and out of its leather sheath. The two things that ruin stored knives are trapped moisture and neglect, and both are solved by five minutes of preparation before the knife goes away.
Wash and dry the blade, including the pivot on a folder. Apply a thin film of light oil, or a food-safe mineral oil if the knife touches food. Wipe handle materials clean, and give natural handles like bone, stag or wood a light oiling too.
Close a folder rather than storing it open, which keeps the edge protected.
Somewhere with stable humidity and moderate temperature. Not a garage, not a car, not a basement that swings damp. Attics are the worst of all: heat cycling drives condensation.
Take the knife out of a leather sheath. Tanning chemicals in leather are mildly acidic and leather holds moisture, which is a bad combination over months.
Look at stored knives once or twice a year, particularly carbon-steel ones. Catching a spot of surface rust early is the difference between a wipe and a pit.
For collections specifically, see storing a knife collection.