Staying overnight at the airport

Whether the airport stays open at night, when security closes, and where you can rest.