The best way to add weight is to increase your intake of complex carbohydrates, particularly whole grain ones. Foods like whole wheat bread, muffins, pasta, crackers, and bagels are good to include. Also, legumes and fruits would be wise choices.
In order to gain weight, you will have to eat more calories. You will need to include regular exercise and strength training into your lifestyle in order to prevent gaining too much weight as fat. And, as I mentioned, those extra calories should come mainly from additional carbohydrate.
To start, set up a realistic goal weight for yourself. You may need to resign yourself to a less than (what you may consider) an ideal weight. Make good nutrition your priority, and weight gain the second.
It is best to gain weight slowly and steadily. This will help to ensure that your weight gain is in the form of lean body mass and not excessive fat. Don't try to gain more than 1/2 pound a week.
Some more tips
Drink 6-8 glasses of distilled water a day.
Eat frequent but small meals.
Eat lots of raw fruits and vegetables (green leafy vegetables are great)
Do not drink coffee, alcohol, soda pop,...
Do not eat processed foods; white sugar, white flower,...
Avoid red meat and animal fats.
Reduce intake of dairy products.
Do not smoke and avoid second hand smoke.