100g nicotine contains 74.0 g C, 8.65 g H and 17.35 g N.
74.9 g C (1 mol C/12.0 g C) = 6.24 mol C
8.65 g H (1 mol H/1.01 g H) = 8.56 mol H
17.35 g N (1 mol N/14.01 g N) = 1.238 mol N
This gives an empirical formula of C5H7N, which has a formula mass of 81.
Therefore, the molecular formula is C10H14N2