You want to know that how the ESM Manager count licenses, and then also what will be happened when licenses are not enough.
The ESM Agent installation do not meter licenses. In other words, before you register the ESM Agents on ESM Manager, either installing or uninstalling Agents do not affect to license counting. ESM licenses are managed in a way that allocates licenses manually. If the number of Agents registered on the ESM Manager exceeds the number of licenses you allocated to the ESM Manager, then you can not do an audit on the ESM Manager. It means that you can not run any policies against any Agents even if the policy run is just for only a single Agent.
If needed you can allocate more licenses to the ESM Manager or delete Agents not used.
To allocate licenses:
To delete Agents: