Shelters come in a wide variety sizes and types, each with it’s own particular style of operation and organization. (It should also be noted that “day shelters” are not usually referred to as “shelters” as sleeping is not normally allowed in them.)
The number of nights a person can stay at a shelter varies depending on the rules and policies of the shelter. Some shelters allow people to stay for only a few days, other shelters allow people to stay indefinitely.
Some shelters require people to be sober, so to be allowed in, but not all have this requirement. Still, all people must behave themselves while in shelters or face removal from the facility.
Some faith based shelters require everyone to attend religious services in exchange for shelter services.
Some shelters also provide food and clothing and minimal health care services.
Some shelters allow the homeless to remain in the facility during the day, while other require people to leave by a certain time in the morning and will not allow people to return to the facility until a certain time in the evening.
And some shelters offer other necessary services, job readiness, education, mail, case management, showers etc.
It should be noted that there is serious need for shelters which allow people to sleep during the day, so that they may take advantage of night and evening employment. I have not heard of any shelter that offers this service.