This article on Polygon does a great job giving a brief overview of why lag (network latency) is an issue in game design and the basic strategies to work around it.
Lag compensation is how the server tries to guess what you were seeing on your computer when you pressed a button on your controller. When your computer tells the server you fired your gun in Battlefield 4, the server rewinds time a little bit so it can guess what you were looking at when you clicked your mouse. If you were aiming at an enemy on your screen, it awards you a hit, even if you were aiming at the wrong place according to the server or your opponent’s computer.
Of course, nobody notices these discrepancies, because it’s really hard to see whether or not your enemy’s gun barrel is pointed at you or slightly to one side of you, especially when there’s simulated blood and screen shake and blurring all over the place. We just accept that we got shot, cry a little bit and move on. Lag compensation works really well in first-person shooters for this reason.