Here is a complete procedure for finding the three required resistor values to get the
range exactly from 0 to 5v (0 to Vref) with the center at 2.5v to the AD input.


The three resistor network is made by connecting a resistor (Ru)
from Vref to ADin, another resistor (Rd) from ADin to ground (0v),
and the input resistor (Rin) from the ADin to your voltage to
be measured (Vin).
By using this network, the AD input will be presented with a voltage (Vou)
which goes highest for the highest input (Vu) and lowest (Vod) for the
lowest input (Vd).

If we assume Vout for 0v input is Vref/2 then the following
simplifications result...

A=(Vu-Vd)/(2*(Vou-Vod))-1
Rin=Rd*A
Ru=Rin/(A+1)

where
Vu is the highest input voltage (+10v in your app)
Vd is the lowest input voltage (-10v in your app)
Vou is the highest output voltage presented to the AD input (max possible is Vref)
Vod is the lowest output voltage presented to the AD input (min possible is 0v)


DESIGN EXAMPLE

Your app must take an input voltage that ranges from -10v to +10v,
and you are using a Vref of +5 volts.  You want to use the full range
of the AD converter so you use Vou=+5 and Vod=0 .
Because your app input ranges from -10v to +10v that makes Vd=-10
and Vu=+10.
The input to the AD converter must be sourced from an input resistance
of 10k or less (we are using 10k as the example here, but lower this
for other chips that require less input resistance).  This means we
can guess the value of Rd to be equal to 20k (twice the value of 10k).

Now we have all the information required to calculate the other two
resistors, but to recap:

Vu=10
Vd=-10
Vou=5
Vod=0
Rd=20 (working all resistors in K ohms)

First calculate A:

A=(Vu-Vd)/(2*(Vou-Vod))-1=1

Next calculate Rin:

Rin=Rd*A=20

Finally, calculate Ru:

Ru=Rin/(A+1)=10

Thus, with Rd=20k the other two resistors come out to be:

Rin=20k
Ru=10k

and we have all the required resistor values.

At this point we can check the input resistance for this network:
RAD=1/(1/Rin+1/Ru+1/Rd)

and adjust the three resistors if necessary.  Doing this
helps us get the highest possible input resistance when needed.
To adjust this we first calculate RAD with the resistors we found
so far:
Rd=20
Rin=20
Ru=10
RAD=1/(1/Rin+1/Ru+1/Rd)=5

then calculate a K factor to multiply all the resistors by:
Rz=10 (this is the max AD input resistance for the chip)
K=Rz*(1/(Rin)+1/(Ru)+1/(Rd))=2

so for this app K=2.  Now we multiply all the previous resistor
values by this K to get the final value for each:
Rd=Rd*K=40
Rin=Rin*K=40
Ru=Ru*K=20

so the final values for all the resistors are:
Rd=40
Rin=40
Ru=20

We dont have to include that step, but it assures that we are using
the maximum input impedance possible for our signal to be measured.


A quick check can be done with the following equations for the input
to the AD converter (Vout here):

Rui=Ru*Rin/(Ru+Rin)
Rdi=Rd*Rin/(Rd+Rin)
Rud=Ru*Rd/(Ru+Rd)
v1=Vref*Rdi/(Rdi+Ru)
v2=Vin*Rud/(Rud+Rin)
Vout=v1+v2

Using the values we found for the three resistors
Rd=40
Rin=40
Ru=20

and the input voltage values:
Vu=10
Vd=-10

and a reference voltage of 5 volts:
Vref=5

we first calculate three constant resistances that simplify the
other calculations:

Rui=Ru*Rin/(Ru+Rin)=13.333333
Rdi=Rd*Rin/(Rd+Rin)=20
Rud=Ru*Rd/(Ru+Rd)=13.333333

now with Vin equal to the highest input voltage we calculate the
upper voltage that will be presented to the AD input:
Vin=Vu=10
v1=Vref*Rdi/(Rdi+Ru)=2.5
v2=Vin*Rud/(Rud+Rin)=2.5
Vout=v1+v2=5

so this calculation checks out ok.

Next we calculate the lowest voltage that will get to the AD input
by setting Vin equal to -10 volts:
Vin=Vd=-10
v1=Vref*Rdi/(Rdi+Ru)=2.5
v2=Vin*Rud/(Rud+Rin)=-2.5
Vout=v1+v2=0

so the lower input calculation also checks out ok.

Next we can verify that for zero volts input we get one half
the reference voltage (one half of 5v is 2.5v):

Vin=0
v1=Vref*Rdi/(Rdi+Ru)=2.5
v2=Vin*Rud/(Rud+Rin)=0
Vout=v1+v2=2.5

This also checks out so we know that for an input of -10v to +10v
we will get a 0v to 5v AD signal, and it will be centered at 2.5v
for a 0v input.


Note that after doing the calculations for the three resistors it is a good
idea to also do the voltage checks, as if there is an error in even one of
the resistors the chip could get blown out.