Although the origins of flamenco are murky, some things are known. The first written historical records refer to flamenco as being sung by a certain Tío de la Juliana in or around the year 1750. There are a variety of theories regarding the origin of the name "flamenco" and there is more disagreement than agreement about the subject among experts. Rather than present too much information about the word flamenco, it seems best to pick the one that seems most likely to me and allow the reader to review other theories if interested.
During the 1700's there was a period in which Spain and The Netherlands had some military and cultural interchange and certain ecclesiastics were invited to Spain to partake in and administer Catholic mass. These Flemish, or Dutch, monks also sang as part of their celebration and some were known to be excellent vocalists. At the time, Spaniards called these Dutch visitors "flamencos". The word "flamenco" is the Spanish word for "Flemish". It seems very plausible that the mostly illiterate population among which flamenco arose could have used the term "flamenco" as a way of complimenting anyone who sung well, perhaps even moreso anyone who sung in a style which may have been more frequent among their social group.
From the earliest known European history, all the way through the 1700's, Spain was a place in which cultures intermingled. Of the groups that occupied, outright controlled, or colonized Spain, one can count the Phoenicians, Carthaginians, Vandals, Visigoths, Byzantines, Romans, Greeks, Arabs, Jews, and the Gypsies. With regard to flamenco, it is primarily the Arabs, the Gypsies, and the general population of Spaniards who likely contributed the most to the formation of this art form.
The Arabs, having spent 800 years mostly in Southern Spain, certainly left an imprint in nearly every area of life from medicine, to architecture, to agriculture, mathematics, philosophy, and ultimately to music thanks in part to the Arab translation and transmission of Greek thought. The problem in regards to flamenco is that there is not a lot of recorded or written history from which to conclude what exactly was left after the Arabs were expelled in 1492.
The Gyspies, it is now known, are a tribe who left India sometime before the 11th century. There were 2 groups of Gypsies that left India; one travelled south of the Mediterranean and spoke Domari, the other travelled north of the mediterranean and spoke Romañí. The latter has now evolved into the language called Caló or Calé spoken by Gypsies today. That modern Gypsies in Spain speak a language that evolved from Romañi, and not Domari, is strong evidence that they did not make their way to Spain through Arab lands, and across the Straight of Gibraltar. On their journey westward from India to Spain, they likely accumulated some concepts and ideas from an array of peoples to the north of the Mediterranean, finally landing in the Catalonia region of Spain in the 1420's and soon after into Andalucía. Interestingly, however, the Gypsies remaining in the contemporary countries between India and Spain do not play music that is directly reminiscent of flamenco, with the possible exception of France. They certainly play Gypsy music, but for the most part, it doesn't follow the same structure found in flamenco.
The general Spanish population also had its own musical heritage and by the 1700's had assimilated it into a variety of musical song forms such as the Seguidilla, the Jota, Campanilleros, Romance, Bolero (distinct from the Latin American Bolero), Villancicos, and others. Some of the Spanish folkloric song forms may have provided rhythmic and other structural bases that later evolved into the song forms now included in what we call flamenco. Also, there certainly were musical concepts that travelled from other European countries that also were present in medieval and 19th century Spain which provided bases for modification.
It was principally from the musical idioms of these three groups, the Spanish population, the Gypsies, and the Arabs, that flamenco was forged. Of all of the 60 - 80 flamenco song forms, those esteemed as being at the core of flamenco seem to have significant contributions from the Gypsies and nearly all flamenco song forms were first sung as opposed to danced or played on guitar. Voice is what what gave the structure and feel to nearly every flamenco song form. It was with time that dance and guitar were added to accompany the voice.
It has been suggested that there were also contributions to flamenco from the Jewish community in Spain, and while that may be true, solid evidence has been elusive. Certainly, the Jews have made many contributions to civilization and it wouldn't be a surprise at all if evidence surfaced linking some origins of flamenco to the Jewish population living in southern Spain. Some authors have suggested that flamenco may have some origins in a musical tradition of lament songs, also practiced by the Jews and in Portugal, as well as exemplified in Portuguese Fado music. Sephardic Jews arrived very early in the history of the Iberian Peninsula, quite likely in pre-Christian times. The Sephardim may have provided songs that were the bases upon which some flamenco song forms arose. However, strong evidence has yet to be published.
Another element about flamenco which is not often referenced, is that flamenco benefits from two distinct musical traditions: modal music, and tonal music. Modal music does not use functional harmony, western tonal music does. Generally speaking, middle-eastern music follows the tradition of modal music as a foundation, whereas the music we all know from classical to jazz, blues, rock and all other sub-genres use western tonal music as a foundation. Both of these musical traditions are used in flamenco, which makes for a very challenging, yet interesting and complete musical experience.
By and large, flamenco originated in southern Spain, more specifically in Andalucia, and to a lesser, but still significant extent in Murcia and Extremadura. Principally, the cities of Sevilla, Jerez, and Cádiz and the nearby towns are often thought to have been the birthplace of flamenco. Granada, Córdoba, Murcia, Extremadura and Málaga also have made important contributions and have also produced major artists.
It should be known that there are song forms that are only sung, which are not played on guitar and which are not danced. There are others that are both sung and played on guitar, but are not danced. Then, the majority combine dance, voice and guitar and often percussion.
It's very important to grasp that flamenco is comprised of many song forms. For simplicity's sake, song forms may be broken up into several groups based on similarity of rhythmic structure if only to give a general idea of some of the more common forms:
1) Tangos, Farruca, Colombiana, Tientos, Tarantos, Garrotín, Rumba, Tanguillo - These are played in some form of 4/4 or 2/4 time.
2) Soleá (Caña, Polo - and predecessors), Siguiriya, Cabales, Cantiñas, Cartagenera, Bulerías, Soleá por bulería, Alegrías, Guajira, Bamberas, Caracoles, Mirabrás, Romeras, Alboreá, Serrana - This group adheres to a cyclic 12 beat structure unique to flamenco, but is usually written in 3/4 time ion most sheet music.
3) Sevillanas, Fandangos, Verdiales, Jaleos (more related to Soleá and Bulería), Rondeña, Jabera, Petenera, Malagueña (although not strictly rhythmic) - This group is often counted and written in 3/4 time or 6/8 time, meaning in threes or sixes, or in some instances alternating 3/4 - 6/8.
4) Granaína, Taranta, Minera, Toná, Trillera, Martinete, Debla, Minera, Liviana - While not all of these are related from having been developed from one common ancestral song form, these song forms do not always follow a strict rhythm in the way most other song forms do and may or may not be accompanied by a guitar. In fact some are rarely if ever accompanied by guitar. These song forms are not generally danced, with the exception of Martinete.
All song forms has a defined verse structure, usually based on a syllabic count per line, with a certain number of lines per verse. It is from the verse structure that the rest of the music takes its form. The vocal range of the singer is what usually defines the key in which a given song form is played on guitar in a specific setting.
Since 1900, flamenco song forms have been expanded and some song forms have been infused with musical instruments and melodies typical of other times and genres. However, the core flamenco song forms (Soleá, Caña, Polo, Siguiriya, Cabales, Tientos, Martinete, Taranta, Toná, Debla, Minera, Trillera) have not changed much at all. Each artist is encouraged to find their own way of interpreting a given song form, respecting tradition, yet infusing their own ideas and innovations and vocal timbre. Over time, the best ideas find their way around flamenco communities and are adapted into each artists style, and become standard.
There are certainly regional variants in the way many song forms are interpreted and local preferences are often respected or quoted by performers. For example, a bulería may be performed one way in Cádiz, and somewhat differently in Jerez, and yet again differently in Lebrija. The fundamental rhythm may be the same, or it may be accented a little differently, but the rhythmic, melodic and harmonic nuances and tempo variations make it sound different in each region.
It is often said of flamenco that it is improvised, and to a large extent that is true. However, the improvisation still adheres to a form or structure that is understood by and usually familiar to the artists. The larger picture is known. What is not known are some of the details that an artist may decide to insert on the fly. Verses can be decided upon moment by moment. Short guitar solos can be inserted when appropriate. Dance choreographies can be adjusted and heel work patterns can be decided during a given song. Part of the enjoyment of performing flamenco is not knowing what will happen next and making the most of the immediate environment and finding the proper response to others in the performance.
Much of flamenco emerged in the intimate environments of family or neighborhood gatherings which led to the development of novel verses, musical phrasing, and dance moves. This aspect is enjoyed by all performers and is essential to tablao style flamenco. More recently, theater style has enjoyed some popularity, which is more rehearsed and polished and employs theatrical innovations that can a enhance the performance.