Detection of dangling modifier
Solution 1:
Position is crucial in the English language. Perhaps the two following examples from two different kinds of modifying issues will help you discover an answer to your question.
Example of a dangling modifier: Running fast as possible, victory was assured.
Note that the modifying phrase at the beginning (often the case in dangling modifiers) is followed directly by something that can not actually do the running. Such a sentence must be recast. Running fast as possible, Bob felt that victory was assured.
Example of a misplaced modifier: High on the hill, I saw the lovely cows.
Note that the modifying phrase High on the hill is followed by "I". This means that the "I" is high on the hill. If that is the intent (i.e. that the "I" is indeed HIGH on the hill, all is well. If the intent is that the "I" observes "cows" high on that hill, then you have a misplaced modifier. To repair this problem, the modifying phrase high on the hill should follow "cows". I saw the lovely cows high on the hill.
The problem is one of clarity of meaning. The misplaced modifier fix here does not remove some ambiguities.
Still position is all! Consider reading Frances Yates' tale at the opening of The Art of Memory to add some depth to this investigation, which I'll call "Every idea in its place." In the story set in ancient Rome, a heavy ceiling falls on diners lying on divans around a long dais. Afterwards, their relatives could not figure out who the individuals were (too mangled to identify) so each might be given proper burial. The Art of memory was born thereby, as the poet (giving the banquet recital--but rescued from the others' fate in the nick of time) revealed their true identities. He accomplished this through his recollection of the exact location where each of his former friends was reclining when they were enjoying their banquet.
Post Script: Castor and Pollux were the ones who rescued the poet with the great gift!