How does ovulation work?

How does it work? Do I start counting 14 days after my period ends or start counting it the first day of my period??