Some hens like to sleep in the nest and while this isn’t necessarily a problem, it can mean that the eggs get very dirty as chickens produce copious amounts of droppings overnight and these can accumulate in the nest, making it very dirty indeed.
Also in warm weather, the nest is a wonderfully cosy, warm place and this can encourage a hen to go broody as this is triggered by a rise in body temperature. If the hens sleep in the nest and get warm overnight, they may like being there so much that they refuse to get off the nest!
A good way to encourage them to roost on the bars where it is cooler and their droppings will fall into the tray beneath the bars is to put something in the nest to block it overnight. A football, brick, upturned plant pot or even a garden ornament will do the job nicely and if you remember to remove it in the morning to allow them to lay eggs, this should do the trick and they’ll learn that the roosting bars are for sleeping on.