The most common answer that people would tell you when you ask them this question is, "Just eat more." You can not simply just eat more because you need to know what to eat to gain weight fast without building up too much fat. If you are looking for a way to gain weight without building any fat, then you are out of luck. However, you can keep the same amount of body fat percentage as you are gaining weight.
Here is an example: Let's say you were 100 pounds with 10 pounds of fat. That is equivalent to 10% body fat. Now, let's say you are 200 pounds with 20 pounds of fat. That is still the same body fat percentage.
So what should you eat to gain weight fast?
I am just going to give you a general idea of what your kitchen should have.
For carbs: oatmeal, brown rice, whole-wheat pasta / bread, lots of vegetables, and fruits.
For protein: egg whites, chicken breast, lean red meat, fish, fat-free milk.
For fat: fish, olive oil, nuts.
Does it feel like it is impossible for you to gain weight because you are eating a lot more than your friends, but you still can not even gain a pound of weight? First start off by eating 20 calories per pound of bodyweight. Then, if you do not see any weight gain in 2 weeks, then increase your calorie intake by 300-500. Repeat the process after 2 weeks if you see no change.
Make sure you spread your meals apart instead of eating thousands of calories in one sitting. If you eat way too much in one sitting, you will end up storing a lot of calories for fat storage.
Of course, you will have to exercise to build muscles otherwise any weight gain that you see will just be fat.