The IRS uses a means of sensing accelerations. (Sometimes laser based, as in a laser gyro, more often a mechanical system).
From that it can integrate what speed the IRS is being moved at, and in which direction, and then integrates speed to determine location.
It's really just very accurate dead reckoning - if I go north at 300kts for an hour, I am 300nm north.
Because of the integration thing, small errors do eventually build up - often called 'drift' and it's best to zero-out the errors at a known position (called 'alignment') or by cross referring to another nav system occassionally for alignment.