rail (n.1) Look up rail at Dictionary.com
"bar," early 14c., from Old French reille, 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. Technically, railings (late 15c.) are horizontal, palings are vertical.
rail (n.2) Look up rail at Dictionary.com
"small bird," mid-15c., from Old French raale (13c.), related to râler "to rattle," of unknown origin, perhaps imitative.
rail (v.) Look up rail at Dictionary.com
"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.