Let’s look at the meaning conveyed by these sentences and critically analyse which one of these sentences presents a logical meaning.
1. In the past several years, astronomers have detected more than 80 massive planets, circling other stars.
In the first sentence, the verb-ing modifier
"circling ...." is preceded by a comma, and hence it ends up modifying the action in the preceding clause. However, the modifier "circling ..." doesn’t makes sense with the action/subject of the preceding clause as this modifier doesn’t present the how aspect or result of the action in the preceding clause. It doesn't make sense to say that astronomers have detected planets by circling other planets or to say that the action of astronomers detecting planets has led to circling other stars. Hence, it is clear that the
modifier is not supposed to modify the action in the preceding clause. 2. In the past several years, astronomers have detected more than 80 massive planets circling other stars.
In the second sentence, the verb-ing modifier
"circling ...." is not preceded by a comma, and hence it ends up modifying the nearest noun entity "80 massive planets". This construction is correct as the verb-ing modifier now correctly modifies "80 massive planets", conveying the meaning that 80 massive planets circle other stars.
So, per the context set-up by the sentence it is clear that the verb-ing modifier "circling" should modify "80 massive planets" and not the entire clause. This sentence is a good illustration of
how the usage of verb-ing modifier is driven by the context set by the sentence.