What are the ridges seen on sprockets and chainrings for? I've always wondered what these ridges below the teeth on sprockets are for. Can anyone enlighten me?
They are there to help facilitate shifting. Basically, the ramps you see help when going from a smaller to larger sprocket by catching the side plates of the chain to help the chain be pulled up onto the larger cog. 

Another place where you will see atypical teeth is in the front; some are shorter/different shaped than others to help shifting as well. Sometimes you see pins as well.