The optical properties of monolayer and bilayer transition metal dichalcogenide semiconductors are governed by excitons in different spin and valley configurations, providing versatile aspects for van der Waals heterostructures and devices. Here, we present experimental and theoretical studies of exciton energy splittings in external magnetic field in neutral and charged WSe2 monolayer and bilayer crystals embedded in a field effect device for active doping control. We develop theoretical methods to calculate the exciton g-factors from first principles for all possible spin-valley configurations of excitons in monolayer and bilayer WSe2 including valley-indirect excitons. Our theoretical and experimental findings shed light on some of the characteristic photoluminescence peaks observed for monolayer and bilayer WSe2. In more general terms, the theoretical aspects of our work provide additional means for the characterization of single and few-layer transition metal dichalcogenides, as well as their heterostructures, in the presence of external magnetic fields.