Sims will autonomously choose to sleep in the bed that belongs to them, or the nearest bed to them if no other options are available. Sims can be directed to sleep in a bed when their energy motive is below 50%, and will autonomously sleep in one if they are very tired. This bed is called the 'Fertillinator', and will increase the chance of success when trying for a baby.
In The Sims Life Stories, there is a §9,000 bed that is only unlocked in story rewards for Riley. Also in The Sims 3 and The Sims 4, sleeping in cheap beds will sometimes give Sims negative moodlets when they wake up. In general, more expensive beds do a better job of restoring energy and comfort. Beds come in a range of prices from cheap to expensive.