The script will select every Nth layer from within a selection of layers or if no layers are selected it will select every Nth layer from the whole comp.
To use scripts copy the file into the Scripts folder in your AE folder, restart AE and run the script from the File->Scripts menu.