When you finish planting your garden for the season, it's common to have seed packets left over, perhaps even some you didn't open. There's no reason to throw these away, as properly stored they can be used next year, and perhaps be good even beyond that.
First, you'll want any seeds you store to be dry. If you have any reason to believe moisture has gotten into the seed packet, pour the contents of the packet onto a paper towel and check. If the seeds are wet at all, leave them spread out in a warm dry place until they fully dry out before putting them back in the packet. (Make sure the inside of the packet is dry as well.)
Seal the seed packets if they've been opened, but then also put them into a larger container. Use a can or jar with a lid-something that will keep out moisture and also block rodents or insects such as weevils and borers.
Tiny insects can sometimes already have infiltrated your seeds but be too small for you to have noticed. In that case, the container won't keep them out because they're already in. So what some gardeners do as an extra precaution is to add a few pinches of diatomaceous earth (DE) to their seeds before sealing the container. DE is a non-toxic substance available at garden centers that protects against insect damage.
To further combat moisture, add one or more desiccant packets. You can either buy silica gel packets (sold in leather stores, camera stores, and many other stores), or make your own. Just take a Kleenex tissue, pour a tablespoon of powdered milk onto the center of it, wrap it up into a packet, and place it at the bottom of your container of seeds. This helps remove moisture from the air inside the container.
Check the inside of your container a few hours after you seal it. If you can feel any moisture on the inside walls, that's condensation that indicates you have not succeeded in creating a dry enough environment. Start over by drying the seeds and the container thoroughly.
The reason you need to be meticulous about keeping your seeds dry is that moisture is one of the signals that tells a seed to germinate (or makes it prone to become moldy or mildewy). Other signals that tell a seed to germinate are heat and light. So you not only want your seed packets to be stored in such a way that they stay dry, but you also want them to stay cool and in the dark.
The back of the refrigerator is a popular spot for seed storage. Some gardeners bury the containers underground. Others keep them in out of the way corners in unheated basements and garages.
How long your seeds will last depends on how well you store them, but also on the type of plant. There's a chart at Growing Taste that gives the approximate survival duration of different seeds. For plants such as collards and lettuce, you may well still be able to plant their seeds successfully after five years or more, if the packets are kept properly stored. Whereas for others such as onions and spinach, you'll be fortunate to get even one full year of successful storage out of their seeds.
Shortly before you want to plant your stored seeds, move the container to a warmer area and let it heat up gradually before opening it, to minimize condensation. Take 5-10 seeds and place them between two damp paper towels at room temperature of at least 65 F. Keep the paper towels damp. Check how many seeds show signs of germination within three days. If most or all of them do, you're good to go. If instead there are no signs of life from most or all of them, then in all likelihood the storage for the packet as a whole was unsuccessful and it's probably not worth bothering to plant the seeds from that packet.