the precise number of layers varying with age and the nature of the forest
This is a new clause, equivalent to
The precise number of layers varies with age and the nature of the forest,
but by casting its verb, vary, as a gerund-participle, varying, we make it incapable of standing by itself as an independent clause so that we can use it as a dependent clause, subordinated to the main clause of the sentence.
Clauses of this kind are called absolute clauses because they 'absolved', 'set free of' the main clause to which they're attached. They're not 'anchored' to the main clause: they aren't subjects or objects or complements of the verb in the main clause, and the gerund-participle doesn't modify anything in the main clause, because it has its own subject. The absolute clause is merely tacked on to the main clause at its beginning or end as a supplement.
The absolute clause is thus a device for structuring your discourse: the main clause carries your narrative or argument forward, while the absolute clause adds information of secondary importance. It has much the same effect as enclosing an independent clause in parentheses:
Careful analysis of the above-ground material reveals that it is arranged in a series of layers. (The precise number of layers varies with age and the nature of the forest.)