One of the problems that face people who take up birdwatching is that everyday names for birds may originate long before any attempt was made to classify them in some sort of orderly arrangement. A bird species' scientific name arises from such formal classification attempts since the 18th century.
Everyday names are described as common names, but these may, or may not, refer to the differences that formal scientific names have established as family, genus, species or subspecies. This irregularity is the reason that excellent questions like yours arise! The UK Sand Martin is the same species as the US Bank Swallow, which is an example the terms Martin and Swallow being used interchangeably, whereas they share not only the same species' scientific name Riparia riparia, but are also the same subspecies R.r. riparia!** (there are three other subspecies, two taczanowskii, ijimae in E Asia and one, shelleyi in Egypt).
All swallows and martins come under the scientific Family name of Hirundinidae. In general, just over half of the 90 or so species in that family have 'swallow' as part of their English name, but a few in the African genus Psalidoprocne have neither 'swallow' or 'martin' in it, being termed 'Saw-wings'. If you thought that it is complicated so far, there is more! The main ornithological authorities that list the world's bird species don't necessarily agree the number of Hirundine species nor do they yet agree on common, or shared English names, but progress is being made in that direction. It is likely that a number of species will be split, but so far, not all authorities have yet got round to agreeing that either, but to be fair, the total number of bird species they have listed is around the 10,000 mark.
If you are mainly interested in European bird species, then you have five species that essentially occur north of the Mediterranean, and two that occur just south of it, and so you can remain securely with, for example, the Collins Bird Guide, for the English names of swallows and martins!
PS Another term for 'common name' in scientific circles is 'trivial name', but since to most people that usage seems a little insulting, it has largely fallen into disuse. However, to 19th-century researchers whose common ground with others whose first language was not English was a knowledge of Latin and Greek from which birds' scientific names were derived, the word 'trivial' meant that any common name in any language was inconsequential in correspondence and in formal publication of descriptions of species.
** It is quite unusual for a breeding species that occurs in North America and across Europe (and good bit further east) to belong to the same subspecies. Most species that share this pattern have subspecies that have evolved in noticeably different ways.
As usual, a (possibly) helpful local difference has been unreasonably stretched globally. In Britain we have three breeding hirundines, the Swallow (now Barn Swallow) with a deeply forked tail with long tail streamers, and two Martins (Sand and House) with only a shallow fork. Thus the two names have tended to be used for the two main tail shapes. In the same way as pigeons and doves do not represent a global distinction, swallow and Martin are not indicators of close relationships. As for why our Sand Martin is the American Bank Swallow, don’t know!
All swallows and martins come under the scientific Family name of Hirundinidae. In general, just over of the 90 or so species in that family have 'swallow' as part of their English name, but a few in the African genus Psalidoprocne have neither 'swallow' or 'martin' in it, being termed 'Saw-wings'. If you thought that it is complicated so far, there is more!
For a brief moment, I thought the German trivial names, addressing all the swallows as "Schwalben", were much more logical, but then I remembered that terns are called "sea swallows" in German, so the confusion is actually worse in my native language! :-D
(I read that swifts sometimes were called "tower swallows" too, but that particular trivial name seems to have fallen out of use long ago.)
Here in South Africa, I tend to think of Martins as the 'browns' and Swallows as the 'blues' or 'irridescents'. We have one example of an intermediate form, namely South African Cliff Swallow, which has a square-ended tail, but a blue back. One of my favourite groups of Swallow found locally is Black Saw-wing - which is, you guessed it...black.