You will know when your hen goes broody because she will do nothing all day but sit on some eggs. Maybe she would come down once per day to eat and drink but besides that she'll just keep the eggs warm.
So, if you notice this kind of behaviour, yes, you can leave the egg underneath her. If she's walking around all day and just sits from time to time on the egg, it will spoil it, you can't eat it and it won't hatch.
Yes, chickens know what to do with their eggs, but they've been domesticated and they are bred specifically for egg production or for meat or for colors and so on. In the wild a bird would only lay eggs in a certain period of time and after laying a certain number she would sit on them untill they become chicks. The domesticated and bred ones don't do that. They lay eggs all year round roughly and get into a broody state usually once a year and usually in the spring.
Hope this helps.