I'm assuming you want to gain muscle mass weight and not fatty weight (the latter can be done just by eating junk and fast foods).
To gain muscle weight, you must do two things:
- Exercise your muscles so they will grow. This basically means lifting weights. There are a wide variety of approaches to lifting and most all of them work. What matters is which one is right for you at your current condition. There are approaches for folks who are already well developed, approaches for folks who are effectively just starting, approaches for targeting specific objectives, and so on.
If you haven't been pursuing a weight training regimen, you'll want to start out with a basic program that focuses on developing strength in your body parts as well as developing your core -- abs and back -- muscle strength and control. Indeed, you'll need to do basic strength training -- which will build mass -- before you really focus on the major mass building techniques. The reason for this is so you don't hurt yourself when you really start piling on the weights and so that you learn the correct form for all your exercises. Indeed, if you do an exercise using perfect form, you'll get the most out of it.
Now, as for how to get started, I'd recommend a personal trainer. I started with one and worked with him five days a week for a year. It did wonders. Not only did it make working out fun -- and I can assure you I don't, even now, think working out is that much fun -- but it made sure I got the absolute maximum out of my workouts. If you don't go with a trainer, you're going to have to go to a book store.
- Eat right to both feed your muscle growth as well as prevent your body from thinking there's a "famine." So what's the famine thing?
Your body needs nourishment all day long. When you let your body go for extended periods without food, it thinks there's a famine and when it has extra calories, it will store them as fat rather than burning them off.
You prevent the famine perception by eating small meals all day long -- every 2-3 hours. A small meal is basically an amount of food roughly equal to the size of your fist. I tend to go with oatmeal with brown sugar and fruit, and a small bit of salmon in the a.m. about 45 min to an hour before working out. A few grapes or a banana or other small bit of fruit during my workout. A piece of fruit right after the workout. Then I do a protein shake and a full on meal -- this tends to be my largest meal of the day. It'll have protein, complex carbs, and fats. If I'm in a hurry, I may go to Chipotle and get a burrito bowl: black beans, chicken, tomato salsa, corn salsa and lemon juice. For the rest of the day, it's small things like a PB&J sandwich, fruits and nuts, and other complex carbs to keep my body fueled. I'll have some fish, chicken or turkey or lean pork in the evening and then one or two more small meals before going to bed.
In addition to preventing famine, you should seek to eat as many calories as your body will burn. Don't eat fewer or you will lose weight. If you eat more, and you aren't effectively preventing the famine, you'll gain weight, but it'll be fat. Just make sure you are feeding your muscles enough protein so they can repair themselves from the lifting. This is how they grow. A good trainer can help you figure out what the right proportion of protein, fat and carbs is given your goals.
One thing you should keep in mind is that you really need to consider you basic body type. If you are an ectomorph, you aren't going to get big and bulky like a collegiate wrestler; your body just isn't designed that way. What you can do is get very lean, muscular and strong and look like a runner, maybe a basketball player, or decathalete.