How many beds are located within the settlement is indicated by the Bed rating. You will need to have at least one bed per resident and a shortage of beds will lower productivity.
There are a variety of beds to choose from in the Workshop menus but they all provide the same function and have no additional effect on the settlement other than cosmetic. You do not need to assign beds to anyone unless you wish to commandeer a particular bed as your own.
In order to keep settlers happy, make sure to place beds under a roof of some kind. Placing beds outside won’t affect the Bed rating but it will reduce the overall happiness of a settlement and will affect productivity as a result. After all, who wants to sleep outside in a nuclear wasteland?
Achieving 100% happiness is not an easy feat and requires a lot of tweaking and constant attention on a settlement. The Happiness rating is indicative of the residents’ overall happiness. A high rating improves food production and any salvage produced by idle workers.
The easiest way to keep settlers happy is to meet the basic requirements of food, water and beds for every resident as well as maintain a Defense rating proportionate to the settlement in question. Exceeding expectations will obviously result in a higher satisfaction across the board.
Having a hands on role by helping settlements in need will also affect Happiness. Listen in to Radio Freedom and keep an eye on your PipBoy for alerts relating to settlements under your control. Completing quests and protecting settlements from invasions will go a long way to increasing the happiness of settlers.
Finally, some of the items in the Workshop menu can increase Happiness. Clinics, clothing and trading stores as well as food and drink stores will all improve happiness. If you purchase a dog for a settlement, its presence will also have a similar effect.