rail (n.1) Look up rail at Dictionary.com
"bar," c.1320, from O.Fr. reille, from V.L. *regla, from L. regula "straight stick," dim. form related to regere "to straighten, guide" (see right). Used figuratively for "thinness" from 1872. Technically, railings (1471) are horizontal, palings are vertical.
rail (n.2) Look up rail at Dictionary.com
"small bird," mid-15c., from O.Fr. raale (13c.), related to râler "to rattle," of unknown origin, perhaps imitative.
rail (v.) Look up rail at Dictionary.com
"complain," 1460, from M.Fr. railler "to tease or joke" (15c.), perhaps from O.Prov. ralhar "scoff, to chat, to joke," from V.L. *ragulare "to bray" (cf. It. ragghiare "to bray"), from L.L. ragere "to roar," probably of imitative origin. See rally (2). Raillery "good-humored ridicule" is from 1653.