One of the best ways to ensure your AR15 always fires is to clean and lubricate it. Most weapon malfunctions are caused by one of two reasons.
Ammo can be one cause of gun malfunctions. Poorly stored ammo that gets wet or cheap crappy ammo can wreak havoc.
Another problem area is a dirty weapon. As a general rule it’s a good idea to clean your gun barrel at the very least after each time you fire. New guns are easier to clean and if you field strip clean often, you’ll find it’s MUCH easier to clean your guns.
You should ALWAYS clean your gun within a few days of shooting it. You don’t need to clean in 5 minutes after you fire but generally within one week will be fine.
Things you need to consider are the type of firearm, the age, and the type of ammo.