Magazines play a critical role in the reliable function of your rifle. There are a few things to consider when stocking magazines for your rifle- build material, capacity, brand, how to carry them and how many to buy. We will discuss primarily AR15 magazines as they are the most complicated, for the AK rifles the rules are simple- Warsaw Pact Surplus steel or Magpul.
Aluminum has a long track record of use with AR15 magazines. Quality aluminum magazines made by Okay/Surefeed, Brownells, NHMTG, D&H, and Center have proven reliable. More recently polymer magazines have appeared, the best are Magpul and Lancer.
Thirty rounds is a standard capacity of the AR15 magazine and what I recommend for most users. I do only load 28 rounds though, not as a reliability issue but to make it easier to seat the magazine when the bolt of the rifle is closed on a loaded chamber.
How to carry magazines is a very personal decision. There are chest rigs, battle belts, belt pouches, and bandoleers. Whatever you choose, having spare, loaded magazines handy is a necessity.
How many do you need? As many as you can reasonably afford. Magazines generally cost between $7 and $20. They are a somewhat fragile and consumable item. Without them, your rifle is not very effective. I recommend a minimum of 12 per rifle.