"complain, speak vehemently and bitterly," late 15c., railen, from Old French raillier "to tease or joke" (15c.), which is perhaps from Old Provençal ralhar "scoff, to chat, to joke," from Vulgar Latin *ragulare "to bray" (source also of Italian ragghiare "to bray"), from Late Latin ragere "to roar," probably of imitative origin. See rally (v.2). Related: Railed; railing.
word-forming element making nouns meaning "place for, art of, condition of, quantity of," from Middle English -erie, from Latin -arius (see -ary). Also sometimes in modern colloquial use "the collectivity of" or "an example of."
<a href="https://www.etymonline.com/word/raillery">Etymology of raillery by etymonline</a>
Harper, D. (n.d.). Etymology of raillery. Online Etymology Dictionary. Retrieved $(datetime), from https://www.etymonline.com/word/raillery