Well, there's ones billed as basically linear but with some known deviation that may be desirable to map out for precision apps. Then there's truly nonlinear ones like a thermistor or photocell.
If it's something that follows a formula, you might try to do the math, usually it's too complex to do easily. So typically we just use a lookup table. Now if you've got a 10 bit ADC you don't want to make a lookup table with 1024 values. What you do there is make a lookup table for regularly spaced adc values, like adc=0, 63, 127... Then do a linear approx for whatever inbetween value comes up. For adc=32, you take the average of the first and second table entry.