This depends on several factors including the type of smoke, the size of the room, the amount of smoke, and whether or not windows remain open. Generally speaking, smoke from cigarettes can stay for a few days to even months.
The main culprits in cigarette smoke that make it last long are resin and tar. The smoke leaves a residue of tar and resin on the walls, ceilings, furniture, etc. present inside the room. Even if you open the windows, the smoke itself may escape but this residue still remains.
As a result, there’s a mild smoke smell present for days on end. It’s more noticeable when you enter your home after several hours. If you smoke heavily, your home may smell like smoke at all times whether you leave the windows open or not.