When entities are deleted, The Things Stack retains some IDs by default to prevent another user re-registering the ID and obtaining historical data. Deleted entities can be restored within a limited time period, but it is also possible for administrators to purge these entities, so that their IDs may be reused.
This reference contains information about how to do delete, restore and purge entities.