I also have noticed that sometimes science needs less points to achieve, but did not understand what does it depend on.
Techs have resource icons on the left - if you have a lab researching that resource, you get a discount.