Because they're able to tell how old the whale is when it died. They're not observing whales from birth to death in each instance. If you tried to do that, you'd be unable to speak on life expectancy on species with lifespans greater than like 10 years.
Quick and dirty: size is a pretty good indicator to approximate, but if you've got yourself a dead whale you can check the bones to get a better number.