The Flux Capacitor...

Okay, seriously. The electronic compass uses a component called a Hall Sensor to detect the earth's magnetic field. It can sense both magnitude and direction of the field vector. Away from the equator, in addition to the horizontal component, the magnetic field has a normal (pointing to the center of the earth) component as well.
Knowing the location of the drone (GPS), it can compare the field vector magnitude, and it's normal and parallel components to what they should be. If there's enough deviation, you get the interference warning.
The shape, size, composition, etc. of an object causing interference is mostly irrelevant. All that is necessary is the weak earth's magnetic field is distorted enough that it can be detected. A tiny 4mm dia. samarium-cobalt magnet a few inches to the side will cause the same problems as trying to take off from a manhole cover.
Similarly, a large, uniform hunk of steel may interfere in such a way that the distortion in effect "cancels out" in the vector math, so doesn't cause a problem.