The requirements are that you can't pass a 4" ball between the ballisters or below them, and on the steps, a 6" ball between the bottom rail and the deepest part of the step. 5 " centers are common, because with a 1 1/2" ballister, they are easy to space using a 2 x 4 (i.e 3 1/2" space), so you are safe (even if the actual ballister is 1 5/16, 1 3/8, etc) but using a minimum number. Just remember when laying out that the spacing is horizontal, not parallel to the step rise.
Easiest way I have found is to cut a 2x4 for the angle of the rise. From the angled face, use a try square to measure back 5" and cut again. This gives you a layout block to mark off the spacing, so you can balance the gaps on the ends. 5" spacing also makes it very easy to calculate how many you need. (One for every full 5" of run).
An example: You have 77" between the insides of your top and bottom posts. Dividing 77 x 5 gives 15 ballisters + 2". Remembering that the first 5" of measurement included 3 1/2" gap before the edge of your first ballister, add the 3 1/2" and 2" for 5 1/2". Dividing by 2 gives a measurement of 2 3/4" between the post and the edge of the nearest ballister to start your layout. (This is assuming you have a 1 1/2" ballister. If not, just use the difference between the actual ballister width and 5" instead of 3 1/2" in your calculation.) The only time this doesn't work is when you are about 3/4" or less shy of reaching a full 5" increment on the horizontal measurement, for which you may have to add one more ballister.
If you buy the pre-cut risers at Lowe's, they are about an 11" run with a 6 1/2" rise, IIRC. which is about a 30 degree rise.