Simply put, you need to eat surplus calories.
You should first calculate your Basal Metabolic Rate (BMR) - see here: http://www.myfitnesspal.com/tools/bmr-calculator
BMR is the minimum calories your body needs to operate in a sedentary state.
Next, you need to approximate how many calories you burn each day during exercise by determining your Exercise Activity Thermogenesis (EAT)
EAT is the caloric output used during exercise activities
Use this exercise calorie counter to estimate how many calories you burn during a particular activity:
d) Finally, Determine the Thermic Effect of Food (TEF)
TEF is how many calories your body burns to process food
On average, 15% of your caloric intake will be required to process food (as low as 5% for hi-carb diets, and as high as 25% for hi-protein diets)
Therefore, the calories you require to maintain your current body composition is BMR + EAT + TEF (approximate calculation).
To gain, you should increase your caloric intake by 15%; safe weight gain should be about 0.5-1 pounds per week - adjust your caloric intake by +/- 5% after observing progress for a week.
Finally, adjust your macros; macros are the major nutrients you are taking in: proteins, fats, and carbs. I suggest you shoot for at least 1 gram of protein per pound body weight, and .4 grams fat per pound body weight - the rest can be a combination of carbs,fats and proteins; carbs and proteins are 4 calories per gram, and fat is 9 calories per gram; divide your calorie intake by these numbers to figure out how much you should be consuming.
You can use a free website like FitDay.com to log your foods and see how many calories and macros you are eating, and make adjustments as you go.