It is an instinct. She is assuming a position which allows a rooster to mount for breeding. It does show she is of age to lay eggs.
Some assume the position more than others. She isn't likely to just plop an egg out. The hens like to do that with a bit of privacy, also instinctive. The don't want predators to see them lay their potential offspring. The nesting box plays on this instinct.