Worried

I've been having a irregular period for quite a while and I feel pain on the right side of my lower abdomen. well I went to the obg and the lady said she need to discuss my results I'm worried that its a cyst on my ovaries, My question is what causes cyst?