How can we detect specific planets in other galaxies, and make claims about its size and even its composition?

I mean I cannot wrap my head around this one. The James Webb telescope is the most advanced imaging we have EVER seen, and that was less than 18 months ago.

You pull that up, and the galaxies are noticeable, yet very small. There’s no way by looking at that you can see specific stars, so how are we seeing planets???? I just do not get or understand it.

Then we make claims that we can detect certain minerals or even water???? HOW!?

I have the same question about black holes, they claim to know the masses, but HOW???? How can you even know the size of it (not mass, true size) when they refer to some as supermassive?

What information are they looking at?