How to list all collections and their objects?
You can access all collections through bpy.data.collections. The objects within the collection (and child collections) are given by bpy.data.collections.all_objects. This is documented in the BlendData types and the documentation of the collection type.
A little example script for printing the content of the collections:
import bpy

for collection in bpy.data.collections:
   print(collection.name)
   for obj in collection.all_objects:
      print(&quot;obj: &quot;, obj.name)