You would use conditional summing as the denominator:
select sum(value*weight) / sum(case when value is not null then weight else 0 end)
If the weights are always bigger than 0, then you don't have to worry about divide by 0. That would only occur when all the values are NULL. And, in that case the numerator would be NULL.
You could also phrase it as:
select sum(value*weight) / sum(case when value is not null then weight end)
or as:
select sum(case when value is not null then value*weight end) / sum(case when value is not null then weight end)
This is more verbose, but makes it very clear that you are ignoring NULL values in both the numerator and denominator.