There are too many variables involved as to why you cannot gain weight. It could be your nutrition is all wrong, your nutritional timing is off, poor workout habits and technique or just simply your genetics sucks. Not trying to be mean, some people are genetically predisposition to not be 'gainers'.
Rather than trying to give you the broscience, I would encourage you to visit
http://forum.bodybuilding.com and do a bit of reading - in fact do a lot of reading. Also, consult your physician to make sure there are no health problems that might be impeding your growth.
Best of luck to you!
Cheers,
Doc