The pleural cavity is, in a normal person, a narrow space between the lungs and the pleura, a membrane that covers the back of the ribs. It is mostly empty, but contains a small amount of fluid. When a person inhales, the lung expands into the pleural cavity. The fluid both lubricates the pleura and allows the expanding lung to cling tightly to the pleura without a physical attachment, maximixing the expansion space.
A pleural effusion occurs when fluid accumulates in the pleural cavity. This can be from excess production of pleural fluid, but can also be blood leaking into the cavity.
A pneumothorax occurs when there there is excess air or another gas in the pleural cavity, preventing the lungs from expanding due to air pressure alone.