I tried a few methods and by far the one that worked best for me was this:
First I use this handy calculator to set my regulator.
http://www.brewersfriend.com/keg-carbonation-calculator/There are charts around that show this same thing if you don't like using online calculators.
Then this formula to calculate line length:
L = (P -(H x .5) – 1 ) / R
Where:
L = length of beer line in feet
P = pressure set of regulator
H = total height from center of keg to faucet in feet
R = resistance of the line from the following table
1 = residual pressure remaining at faucet (this can be increased to 2 if you need to increase pressure to increase dispense rate)
Table to determine "R" (beer line type)
3/8” OD stainless beverage tubing = .2
5/16” OD stainless beverage tubing = .5
1/4” OD stainless beverage tubing = 2
3/8” ID plastic beer line = .11
5/16” ID plastic beer line = .17
1/4” ID plastic beer line = .7
3/16” ID plastic beer line = 2.7
I found this formula here:
http://www.brewersfriend.com/2009/07/18/getting-a-good-pour-kegged-beer-co2-line-length-and-pressure/