Boresighting is a method of visually pre-aligning a firearm barrel's bore axis with the target, in order to more easily zero the gunsight (optical or iron sights). The process is usually performed on a rifle, and can be accomplished either with the naked eye, or with a specialized device called a boresighter.
Optical boresighting, also referred to as "eyeball boresighting", as the name suggests, involves using the naked eye and the bore axis of a firearm to dial in the sights of a firearm. Based on the type of firearm the procedure for optical bore sighting will vary. For AR style rifles the upper receiver can be dropped from the lower receiver and the bolt carrier group (BCG) can be removed exposing a clear line of sight through the barrel. With the upper receiver fixed in place you can then co-witness thorough the barrel and the sights on the top of the rifle, while doing this you can visually align the bore axis with the sights on a desired target. For bolt actions rifles the process is the same aside from the ability to remove different receivers, but the bolt can still be removed to view through the barrel.
Once you are able to align the bore axis and the sights on the firearm you should then be able to at least get shots on or close to the target. With the rifle reassembled you should be able to put shots down range and make more fine tuned adjustments.
A draw back of using the naked eye to boresight is that it can be difficult due to the tunnel vision and lack of brightness, especially with longer-barreled guns. A more advanced method of boresighting uses a collimator boresighter, an optical attachment similar to a scope sight, which fits onto the muzzle end of the barrel via a bore-diameter arbor and projects a grid pattern onto the sight picture. Using this method, the normal sight (which is fixed to the receiver) and the collimator (which is fixed to the barrel) can be sighted to match. Most collimators have grid patterns for rechecking the zero after the barrel is sighted.
A more modern method of boresighting is to use a laser pointer to illuminate the distant point of aim, rather than using visual inspection. This method is preferable because it has less parallax, allows more movement in the gun as the projected laser beam will stay true to the bore axis, and does not require removing the bolt.
As laser technology has become more affordable and portable, laser boresighters have become popular for sighting in riflescopes. One type of laser boresighter is shaped like a cartridge, and when inserted into the chamber projects a laser beam through the barrel onto the target. The user then adjusts the iron sights or scope reticle to align the point of aim with the projected laser dot. Another more commonly used type of laser boresighter is attached to the muzzle of the barrel, either inserted straight into the bore ("arbor" type) or held in alignment with the barrel via a magnet, and projects a laser beam onto the target. Again, the user aligns the sights to the laser dot on the target.
No matter which method of boresighting is used, the result is to align the sights to the spot where the barrel is pointing at a particular distance. Because of variations in the projectile trajectory and other factors, the boresighted rifle will always shoot below the boresighted spot and is only meant to approximate the actual points of impact, namely getting the shots "on paper" (landing in proximity to the point of aim). Live ammunition will need to be fired to further fine-tune the sighting process.
Accuracy is the measure of how well the sighted object is represented. It can be measured from a specific decision-making circumstance, like the orientation of notches of a gun barrel. Alternatively, the device could be designed to accommodate a range of circumstances and still be sufficiently accurate.