I have often seen gulls "pattering" their feet in tidal mudflats, as it seems to attract worms and such-like to the suface to provide a tasty (to a sea-gull) meal.

Presumably, for the birds, this is either an evolutionary trait, or at least a learned one.  But what is the reason that the worms rise?  If I were a worm, and heard the pattering of a gull, I'd burow away as fast as possible!

All I can think of, is that they mistake it for something else- the tide coming in, perhaps?  But wouldn't evolution tend to select against such behaviour, as those that rise get eaten, and hence are unable to reproduce?

Thanks in advance for any comments.

The worms need to rise when it rains/the tide comes in, in order to feed, so it would be very difficult for them to evolve away from this response.