ESPHome - How are variables (text, numbers, etc) handled for comparison, and so on?

Yes.

I struggle with logging sometimes too. Keep at it.
I find it easier to use the lowely documented ESP_LOGD(). Often it’s type conversion.

Once you get to more advanced usecases with lots of lambda your probably better off just trying to find some examples on the forum rather than trying to use the docs. There will be examples of most things you want to do somewhere. If you want to understand lower level things you can also try the ESPHOME Discord. I don’t know how things work under the hood much myself. Just self taught through examples rather than the theory.