What is the expected number of rings obtained in the following ring formation process?
There is no simple answer here because the outcome will be heavily dependent on the concentration and on the rate of addition.

The most salient point in your question to me is: "excess ammonia."

You can ask what the competing reactions are.


1,5-dibromopentane reacts with ammonia to form 1-amino-5-bromopentane
1-amino-5-bromopentane reacts with itself to form piperidine
1-amino-5-bromopentane reacts with ammonia to form 1,5-diaminopentane
1-amino-5-bromopentane reacts with another straight chain alkyl amine to elongate the chain
1,5-dibromopentane reacts with piperidine to form N-(5-bromopentyl)piperidine
and others...


The main problem I see is that in excess ammonia, unless you perform a slow addition of ammonia, the concentration may be such that the ammonia will over add via (3). Then you're going to get any product. The intermediates are also reactive, so the reactant concentration has to be relatively low as well, otherwise, you may see (4) or (5) or other side reactions. You may also need to run the reaction at lower temperature to disfavor reaction of the product with any alkyl bromide intermediate or reactant.

These issues need to resolved before you even begin to think about distribution of ring sizes because you might not even form any rings.