You paste into Nethack with the usual means of your operating system. For example, in OS X, you paste using Apple + v into the respective popup opened by the tiles port, or using Apple + v into the terminal window you telneted to NAO with. A terminal application such as putty may also offer paste in its menus. With the tiles port, you can only paste whenever the game prompts you, e. g. what to engrave or wish for.
This is useful with ElberethElbereth.
Beware, pasting junk you accidentally left in the clipboard into the tty port often results in Yet Another Stupid Death. Another hazard is IP packet fragmentation if you are playing online and paste large chunks. Unrelated but similar in effect is an unreported bug where Nethack occasionally will behave as if large portions of random text were pasted into its input stream (observed on OS X with both NAO and tiles port).