It really depends on the time of the year, the type of bird, and its preferred nesting place. Most will perch in trees/bushes at night. Its usually only if they are in their breeding cycle (mating/laying/raising chicks) will the birds sit on/in nests. Some like gulls will sit in cliff faces, and some parrots will sit in tree hollows, etc. on a nest i think in trees or houses..we have a cardinal that has been sleeping above our backdoor since the beginning of the summer...i guess it's where they feel safe in thier nest Birds have locking feet that allow them to stay on a branch and get a little sleep without falling off.
I don't know what happens when they have bad dreams. wherever their nest is. or wherever is safe to them in their nests most likely
:D well if it is a wild bird most likely in a tree or it's nest or somewhere on the roof of a building
if its a pet then on its cage birds usually find a branch to land on and stand slleeping if they have a nest they would sometimes sleep there in trees