Once a piece of gut tied across the neck of a stringed instrument, later pieces of raised wood or bone were used in the same place. These days, it is standard manufactured steel or nickel silver wire. When is string is pressed against one of these raised frets, it shortens the length of the string and raises the pitch of the note played.
The positioning of the frets is critical to the playability of the instrument. Most fretted instruments with semitone spaced frets use equal temperament which is the standard of Western music.
For any given length of instrument, the length from the bridge to the nut (or fret zero) is the starting Scale Length. Dividing this exactly in two gives the 12th fret position which is the octave of the open string. The ratio of spacing of two adjacent frets is given as the twelfth root of 2 (or 1.059463). Luthiers generally use a constant of 17.817 to calculate fret positions under equal temperament. The scale length is divided by 17.817 to give the spacing from fret zero to the first fret. This is subtracted from the scale length and the same process applied to get the spacing from the first to second frets and so on for as many frets as desired. This also explains why the distance between frets diminishes as one goes up the fingerboard.
Special fret positions are marked with dots on some instruments. Typically the 12th fret and 7th fret are marked with an inlay of some kind but often the 3rd, 5th and either 9th or 10th are marked too. This makes it easy to find chord shapes, barre chords and finger positions.