The ratio between the spindle gear and the leadscrew gear is what sets the pitch of threads when you are cutting them and the speed of the carriage movement when you are turning using the feed screw for horizontal feed.
With a spindle gear of 40t and a 12TPI lead screw you could divide 480 by the required TPI to get the number of teeth required on the feed screw.
For example, for a 24tpi thread divide 480 by 24 gives 20, so 20 teeth required on the lead screw. Intermediate gears will not change the ratio provided you do not use compound gears.
Basically - a 1:1 ratio (Spindle:Lead screw) would be 12 TPI. a 2:1 ratio would be 24 TPI and a 1:2 would be 6 TPI. Others ratios as required for the particular TPI.