Is the ines header used when a rom is run on real hardware, or is it just a convenience for emulators?
No it's just a convenience for emulators.
If by "real hardware" you mean any hardware manufactured by Nintendo:
PocketNES for Game Boy Advance uses an iNES header, and several classics compilations licensed by Nintendo contain PocketNES. Other homebrew emulators, such as nesDS for Nintendo DS and FCE Ultra GX for Wii, also use an iNES header. And I've been told that the ROM images in Virtual Console channels contain an iNES header, though I don't know whether the emulator actually uses it or whether things like mappers are hardcoded into the emulator.
If by "real hardware" you mean specifically NES hardware:
PowerPak uses the iNES header when loading the ROM and configuring the mapper FPGA. It's the only NES cartridge I know of that uses the header.
The iNES header exists because emulators can't tell what kind of cartridge a game uses based on the ROMs alone. The purpose of the iNES header is to give emulators information about the board inside the cartridge where the game comes from. If the game is in an actual cart, the board is there with the ROM, there is no need to describe it.
Perhaps slightly offtopic.. Some games seems to have some kind of internal header stored inside the ROM itself. I think this has been discussed before.
Purpose is unknown(?)
We talked about the internal headers on some later NES games in
this topic. Feel free to necro there if you have something interesting to say.