renting a room?

This sounds silly but how does ' renting a room work' in the uk I know we do it a lot, if you rent a room of someone do they have rules or ? I'm looking to rent a room as will be cheaper but I'd still want to go out and see my boyfriend ect .. Can you walk in and out of the house when you want and can your bf Come see you? Like how does it all work, I don't want to rent a room but have a curfew or something. I'm young and I do a lot of things! ( I would be very respectful) I just mean like coming home late ect ...