Called a telltale. As Matt says they were used to tell brakemen to duck before bridges and other low clearance locations. We used to have some on the rail line near me including on the mainline bridge crossing the Merrimack River. I checked and those are gone now, but the one over the former Bradford to Georgetown branch is still there even though that's a bike trail now.