To reel in the very broad question you have to the relevant topic (the AI "torture" chamber):
How do we know humans experience pain
You experience pain and know what this is like. It would be a little absurd to think that your friends and family don't experience this as well (obviously excluding persons in vegetative state)
How can we be certain an LLM doesn't experience pain
Philosophers mostly agree that LLMs aren't conscious, despite not agreeing on what exactly consciousness is or, relatedly, what causes consciousness.
A computer computing the forward pass of a model is merely a Von Neumann machine following serial instructions one-by-one manipulating discrete (non-continuous) data. The brain is a parallel, distributed computer with dynamically changing neural structure operating on continuous potentials. LLMs do not replicate this nor do they come close to an approximation sufficient to replicate the causal powers of our brain, thus they are not sufficient for understanding and experiences in the capacity that humans (or other sentient animals) do.