The short answer: black spots on a bathroom ceiling are mould, caused by steam rising and condensing on the coldest surface in the room with nowhere to go. Most cleaning guides tell you to scrub them off with a brush. Public health guidance says the opposite: do not brush mould, because brushing releases spores into the air you are standing directly underneath. Wipe with a damp disposable cloth or vacuum instead, apply a mould treatment and let it work rather than scrubbing it in, and wear gloves and a mask while you do it. Then fix the ventilation, because a ceiling that has grown mould once will grow it again in the same place within months if nothing about the room changes.
Disclosure: this post contains affiliate links, and as an Amazon Associate I earn from qualifying purchases. If you buy through them I may earn a small commission at no extra cost to you. I only recommend things I would use in my own home.