Clicking sound on each rotation of the pedals only when riding
While everyone here suggesting the bottom bracket is the likely culprit (and they're probably right), I wanted to comment nonetheless and point out that this could easily be the less common issue of worn bearings in one of the pedals.

Try rotating the pedals with your hand. If they don't spin smoothly, that's a good indication that you've got a bad bearing. You can try taking the pedal apart and repacking the bearings/grease, but odds are the track is pitted. The pedal will continue to fail. Unless it's a clipless or expensive pedal, just buy another pair. They're cheap.