They occur with running or exertion and resolve with rest. There are no definite answers to what causes them, but there are some theories. In general, stitches will stop occurring as you get more fit. They are believed to be caused by inefficient blood flow, a phenomenon that improves with regular training. They should become less frequent and are likely to disappear if you are running several times a week.
Many runners find stitches to be breathing related, occurring with heavy breathing.
These kinds of stitches resolve with gentle shallow breathing and rest. Putting your arms over your head and lying down should stop the pain quickly. If you do not want to interrupt your run, try leaning to the side of the pain, breathing through pursed lips, and slowing down the rate of breathing. If breathing muscles are not well trained, they are more susceptible to the low blood flow and can cramp and cause pain. Poor sleep, dehydration or poor nutrition may make you more prone to recurrence.