Determine the PSI you will need to properly carbonated beer. That's dependent on the volumes of CO2 you want and the temperature the beer is stored at. For example, an American IPA at 38F and you want 2.4 volumes of CO2. According to a
carbonation table, you need to set your regulator to about 10 PSI. Note that the regulator should never be set to some sort of "serving" pressure. It should always be set to the appropriate pressure to carbonated your beer (or keep it carbonated and at equilibrium).
In order to pour properly at about a 1 gal/min flow rate, you need to consume most of this pressure before the beer gets to the tap. That depends on how high the tap is compared to the middle of the keg. For each foot of height difference, there is an 0.5 PSI pressure drop. So if your tap is 2 feet higher than the middle of the keg, you will lose 1 PSI. Since you are set to 10 PSI, then you have 9 PSI left. All you need to do is to then use enough 3/16" inside diameter hose to reduce the rest of the pressure (or most of it). The average pressure drop for typical vinyl beer hose is about 2 PSI per foot. So you'd need about 4.5 feet of hose. Note that the pressure drop figures for beer hose typically take into account a 1 gal/min flow rate.
Problem is that this assumes you cool the beer lines just as well as the beer in the keg--which many people don't. If the lines are warmer, then some CO2 will come out of the beer and into the lines, thus causing foaming problems even if your lines are long enough and so on. So we typically err on the side of caution and say to get 10 foot lines. That helps to handle all of the inconsistencies in your system. If the pour is way too slow, cut off 6" of the line and try another pour. Keep doing this until you're satisfied.
On my system, I have several different lengths of beer line. I have separate regulators for different styles of beers (therefore different carbonating pressures). For most of my pale ales, I carb to 2.2 to 2.4 volumes. My lines are the proper length for those beers. For other beers like pilsners or light lagers, I carb at 2.5 or more volumes. My lines for those beers are a little longer.