After more thought, I am puzzled why Atmel specifies the formula

v = (Vref/1024)*n

for converting an ADC value, n, to voltage v.

This formula, that I sometimes use, is no better.

v = (Vref/1023)*n

An ideal 10-bit ADC returns the value n for voltages between (Vref/1024)*n and Vref/1024)*(n+1).

It seems like you should use the average value of voltage for bin n. The formula for the average bin voltage is:

v = (Vref/1024)*(n + 0.5)

The Arduino ADC is anything but ideal so I calibrate it, as above, for accurate measurements.

The problem with calibration is that non-linearity is a ragged function so you can't just do a few measurements to get a good calibration.

I measure the response of the ADC for over 4000 voltages. I use a linear fit to these measurements. This gives very good results for almost all ATmega chips.

That brings up the question of how can you select the best chip based on a few measurements?

ADC theory articles often show smooth curves for integral non-linearity but for real parts the plot is a very ragged/jagged line. A calibration based on just a few measurements is an improvement but nowhere near optimal.

A comment on the S/H impedance measurements. These measurements should not be relied on for real situations. Stray capacitance becomes a key factor for high impedance sensors.

High impedance sensors are not likely to output high frequency signals so you can improve accuracy by adding a 2-20nf cap between the sensor's analog pin and ground.

When the ADC MUX switches to this pin, the charge in the pin cap will be used to charge the S/H cap. The S/H cap is about 14pf so the S/H voltage will be accurate to 1% if you use a 2nf cap and 0.1% for a 20nf cap.

Of course the best solution is to use a good op-amp and filters to condition the signal from high impedance sensors.