A cyst is a closed sac, having a distinct envelope and division compared with the nearby tissue. Hence, it is a cluster of cells that have grouped together to form a sac (like the manner in which water molecules group together to form a bubble); however, the distinguishing aspect of a cyst is that the cells forming the "shell" of such a sac are distinctly abnormal (in both appearance and behaviour) when compared with all surrounding cells for that given location. A cyst may contain air, fluids, or semi-solid material. A collection of pus is called an abscess, not a cyst. Once formed, a cyst may resolve on its own. When a cyst fails to resolve, it may need to be removed surgically, but that would depend upon its type and location.
Cancer-related cysts are formed as a defense mechanism for the body following the development of mutations that lead to an uncontrolled cellular division. Once that mutation has occurred, the affected cells divide incessantly and become cancerous, forming a tumor. The body encapsulates those cells to try to prevent them from continuing their division and contain the tumor, which becomes known as a cyst. That said, the cancerous cells still may mutate further and gain the ability to form their own blood vessels, from which they receive nourishment before being contained. Once that happens, the capsule becomes useless, and the tumor may advance from benign to cancerous.
Some cysts are neoplastic, and thus are called cystic tumors. Many types of cysts are not neoplastic, they are dysplastic or metaplastic. Pseudocysts are similar to cysts in that they have a sac filled with fluid, but lack an epithelial lining.