You need to be at least somewhat musically inclined, and then it's years and years of training. If you study / play music for long enough you learn, either consciously or unconsciously, the patterns that make up 99% of it, and your brain will predict them for you, that's how jazz bands are able to improvise so well. You also develop a muscle memory for an instrument, where you can instinctively play a melody without thinking about it. Picking it up this fast is impressive, but it's also not prodigy tier, it's professional studio musician tier. Professional musicians are impressive though. I would probably need to rewind each part 5+ times to nail it down (not the full song, but just the chord progression / basic melody, like she's doing)