Simple physics tells you that the less you have to carry up the less work is required to do it.
Simple mathematics tells you that reducing a weight of about 100kgs by 1kg or 2 kg or 5 kgs will get you up hills by a few seconds quicker.
As I said, do it as a project, but if you are expecting performance gains by lightening a bike by a few kilos in the context of a typical UK mountain biker, you really are having a laugh….
There are two "non-technical" explanations for the effects of light weight. First is the placebo effect. Since the rider feels that they are on better (lighter) equipment, they push themselves harder and therefore go faster. It's not the equipment that increases speed so much as the rider's belief and resulting higher power output. The second non-technical explanation is the triumph of hope over experience—the rider is not much faster due to lightweight equipment but thinks they are faster. Sometimes this is due to lack of real data, as when a rider took two hours to do a climb on their old bike and on their new bike did it in 1:50. No accounting for how fit the rider was during these two climbs, how hot or windy it was, which way the wind was blowing, how the rider felt that day, etc.
Another explanation, of course, may be marketing benefits associated with selling weight reductions.
…admittedly from Wikipedia, but a nice summary all the same.