"construction in which rails form an important part," early 15c., verbal noun from rail (v.2). Technically, railings (late 15c.) are horizontal, palings are vertical.
"horizontal bar passing from one post or support to another," c.1300, from Old French reille "bolt, bar," from Vulgar Latin *regla, from Latin regula "straight stick," diminutive form related to regere "to straighten, guide" (see regal). Used figuratively for thinness from 1872. To be off the rails in a figurative sense is from 1848, an image from the railroads. In U.S. use, "A piece of timber, cleft, hewed, or sawed, inserted in upright posts for fencing" [Webster, 1830].
"small wading bird," mid-15c., from Old French raale (13c.), related to râler "to rattle," of unknown origin, perhaps imitative of its cry.
"complain," mid-15c., from Middle French railler "to tease or joke" (15c.), perhaps from Old Provençal ralhar "scoff, to chat, to joke," from Vulgar Latin *ragulare "to bray" (cf. Italian ragghiare "to bray"), from Late Latin ragere "to roar," probably of imitative origin. See rally (v.2). Related: Railed; railing.