A sextant is a nautical instrument in the shape of a sector of a circle.
At the centre of the circle is a mirror, which juts out at a right angle to the plane of the circle. This mirror can rotate about an axis passing through the centre of the circle. The mirror is rigidly attached to an arm which extends to the circumference of the circle. Using the arm, the angle of the mirror can be read from a scale on the arc. (Actually, the values on the scale do not correspond exactly with the angle of the mirror, some calculations on the angle are performed first. More on this later.)
Along the chord (the widest part of the instrument), on one side is a small telescope and opposite it is a disc. The disc is split in half vertically, one side is transparent and one side is reflective. Looking through the telescope, one sees straight ahead through one half of the disc and sees the mirror on the other half.
Now for the clever bit. The disc is angled so that looking through the telescope, the half-mirror on the disc reflects the mirror at the centre of the circle. The mirror at the centre of the circle can rotate to different angles, so looking through the telescope, half the view is straight ahead and half the view is at an angle.
One common use of the sextant was to determine the altitude of the sun while at sea. To do this, the sextant is held vertically (curved side down), and the sailor stands facing the sun. The sailor looks through the telescope so that the horizon is visible through the transparent half of the disc. The sailor then swings the arm until the sun is seen on the reflective half of the disc. (There are several very heavy filters to reduce the light of the sun, so the users of the sextant do not go blind.) The centre of the sun on one half of the view is lined up with the horizon on the other half, and the angle of the arm (read from the circumference) is noted. There is a direct relationship between the angle from the horizon to the sextant to the sun (i.e. the altitude of the sun) and the angle of the mirror at the top of the sextant. That relationship is the calculations referred to earlier, so the angle of the arm is the altitude of the sun.
Another use was to determine the distance to an object of known height (another ship, or a building). Using some trigonometry, the distance to an object (the adjacent side of a right-angled triangle) can be calculated from the height (the opposite side) and the angle (measured with the sextant). For the most accurate results, measurements would have to be taken at sea level. For big ships, using a sextant above-decks would introduce errors in the calculation (the opposite side of the relavent triangle would be shorter by the height of the sextant above the sea). But, sailors learned to correct for that error, and still got accurate measurements.