In studying music theory I have heard the term Neapolitan 6th quite a few times, but I'm not quite sure what it is. What is a Neapolitan 6th and how is it used in a composition?
It is a Major triad built on the lowered 2nd scale degree. It's usually in first inversion, hence the "6th" part of the name. So if I'm in C-minor, the Neapolitan 6th (sometimes analyzed as N6 or bII6) would be a Db-major triad, probably with the F in the bass. They are chromatic harmonies, and their primary function is to go to V.
EDITED TO ADD: There is a very particular voice-leading involved also, usually the voice that has the b2 note moves directly to the leading tone in the upcoming dominant harmony. This is a rare example of a diminished melodic third being standard practice.
A good example is in beats 3 and 4 of the 3rd measure of the first movement of Beethoven's "Moonlight" Sonata. The piece is in c#-minor, and the 3rd measure starts on A (VI) and moves to a D Major chord in first inversion (the Neapolitan). The D-natural root of that chord is chromatic to the key, and is what causes the harmony's somewhat exotic quality. It's an alteration of the diatonic d#-dim (iio) chord that could just have easily have been used here, but would have been far less dramatic. Either way, the next harmony is V (with some cadential 6/4 action thrown in for seasoning).
A Neapolitan sixth chord is a "chromatic" triad in first inversion that is built a half step above the tonic. In C-major, the Neapolitan sixth chord is a D♭/F chord. In a-minor, it is a B♭/D chord. The chord is indicated as N6.
In harmony, the function of the Neapolitan sixth is to prepare the dominant, just like the subdominant or the supertonic chord. We must remember that the term "half step" indicates a minor second in this case. We must NOT write the chord as a C♯/E♯, A♯/Cx, etc.
The Neapolitan sixth can also occur after a German sixth chord. A German sixth chord is one of the augmented sixth chords. In C-major, the chord is known as A♭add+6 chord, with the notes A♭, C, E♭, and F♯. If a German sixth chord resolves to the neapolitan, it can serve as a pivot chord to tonicize the Neapolitan as a tonic. The A♭add+6 chord is enharmonically equivalent to A♭7. In this case, the German sixth chord could lead as a secondary dominant to the Neapolitan, so the progression is: Ger. 6 - N6.