How Earn Leave works in the system?

How Earn Leave works in the system? can anyone describe me please. I cannot get clear picture from the documentation.

And is it possible to add earn leave based on attendance?