It could be a number of things. Is it the same file on multiple devices? For instance, you could have a lower bit-rate MP3 or AAC file on some devices than others. If you're streaming, perhaps some devices are getting a lower quality stream.
Headphones are miniature versions of regular speakers. They have
impedance values and sensitivity ratings just like every other speaker. As such, different amplifiers make slight differences in the performance of the speakers. When the iPad Air 2 came out, it was Apple's most fancy tablet and they charged serious money for it. As such, they might've specified a higher quality headphone amp than you might find in a less expensive phone.
Finally, it is a bit of an art of turning digital bits into an analog signal. This is done by something called a
DAC (digital-analog-converter). Different DACs produce slightly different sound from the same digital input.
In the land of audiophiles, folks spend serious money for fancy DACs, speakers, amplifiers, and just about everything else because they perceive a difference in the sound produced. In the realm of headphones, differences between headphone generally produce the most noticeable changes in sound. Same song, same player, different headphones sounds slightly different. It is less common, but entirely possible, that your ears and headphones are good enough to hear a difference between players with the same song and headphones.