First, this is governed by FEDERAL law and regulation- so laws and regs AT A MINIMUM are the same in all states. Some like Illinois require more.
Typically, one govt issued photo ID, showing your address, and a second form of ID showing same address. That could be car registration, voter ID card, utility bills, etc. In the case of active duty military, your military ID, AND your orders assigning you to that installation.
There is no residency requirement to buy a rifle or shotgun from a dealer. As a resident of VA, I can walk into a Kansas gun store, and buy a long gun. No residency requirement to buy ammo.