If, after three days, they determine that you're not a danger to yourself or anyone else, out the door you go. If they determine that you're in harm's way, they talk to you and make recommendations. You don't have to agree to any of them. Typically they involve plans for moving forward, like making arrangements to see appropriate medical professionals on a regular basis, finding housing (if you're homeless), enrolling in rehab... whatever is relevant to your case.
If they decide you need to stay, but you say you want to leave, they can either take the matter to court, or they can let you walk out the door. I've only ever talked to one person who landed in that situation; it doesn't seem to happen to most people who get sectioned.
Obviously, some areas of the US have worse medical and mental care than others. If you're in a part of the US that's lacking in that regard, it could be more like a jail sentence than assistance.