It’s like watching colors and recognizing them. There’s no trick to it. It’s just the ability to recognize any given pitch without a reference note. You just listen to a tone and know that it’s a C sharp. Same as watching the clear sky and knowing that it’s a certain shade of blue. Intrigued? Read about relative pitch.