Yes you would buy a waterproof transparent glue from the guys who sell you the hair. You put a very thin layer of it on your scalp then let it dry until its tacky. Then you lay the hairpiece onto it and press it in with a comb, or you can tack it down a little at a time while stretching it for a skin tight fit (which is what I do) and it wont come off in winds, rain, swimming, etc like people think they do.
Yes you can wear it to bed, I wear mine for a week to ten days before taking it off to clean and put new glue on.
The only people I even encountered in the forums who`ve had their come off where people who were using the wrong type of glue and had it on for way to long like over 2 weeks without changing to new glue.
They also put it on wrong.
If done correctly it wont come off unless you go to a hockey game, jump on the ice and start swinging.....