Okay so the question is what is the fastest and safest way to gain weight. First off, it's important to decipher whether or not you want your weight gain to be lean muscle mass or body fat. If you're looking just for body fat with no regards to body composition, then all you need to do is to increase your caloric intake so that you are in a caloric Surplus at the end of the day.
The most efficient way to track this would be to write down the amount of calories you have taken in and then weighing yourself and next day. If you lose weight then you need to eat more calories. If you maintain then that caloric intake is your maintenance. But if you gain weight then that's your caloric Surplus.
However most of us want to gain lean muscle mass. In order to do this not only do we need to be in a caloric surplus but we want to make sure that we utilize resistance training to increase our muscle mass. Studies have shown that for muscle hypertrophy or increase in muscle mass, that it's best to train with heavier weight for lower repetitions. I have found that the most effective rep range is 6 to 8 repetitions.
Focus on the most fundamental exercises for each body part. For example for the chest utilize barbell bench press for the quads utilize barbell squats and so on and so forth. The fundamental exercises are the ones that will help you build overall muscle mass. lastly you want to make sure to increase your protein intake. Protein is responsible for muscle growth repair and maintenance. My recommendation is typically 1 to 1.5 grams of protein per pound body weight.
In summation if you utilize these principles you should be able to gain weight.