No worries you don't get educated about ants in school, they are usually just looked at as a social insect that has come far from its wasply days, so most people don't know to much.
In most species, "flying ants" are Really alates. They are the reproductives for the species of ant, Their are, Males, and Females.
Males, in most species are used in one rule, Mating. That is it, they are not hardwired enough to complete the complicated task of tending to larvae, or moving around dirt, they have no real use in the colony except for keeping the genetics of the colony alive.
Females, are all the workers in the colony. They are the easiest and cheapest to produce, and keep alive, and thus the colony runs on female power to keep a colony alive. But the queen, decides how many get to be capable of reproducing. Now this varies from species to species, and is generally decided upon by the queen and the internal clock she is programed with, but it can also be apart of the nutritional intake the workers bringing. Protein usually rules how much of what gets laid, males females.
but when the queen decides to make reproductive female alates, she lays an egg which will eventually turn out to be a flying, reproductive capable ant.
Hear is a picture of reproductives. You can see the Females, are larger and bulkier for all the hardware they need to reproduce, while the males are allot smaller with smaller heads, you don't need allot of space to be hardwired to look for a female and mate with her. This species Lasius is a great example of female, male and worker castes.
They haven't mated yet, and are getting ready for the mating flight!
Their are many unique ways of an ant to mate, some species of ant don't even fly, such as Myrmecia sp's the Bulldog ants or Jumping Jacks of Australia! They produce males and females in much the similar manner, but they don't fly, they are so primitive. Their are some other speices of ant that are even more primitive that they have all females in the colony capable of producing but usually the top female is the one that reproduces, this ant to is in Australia, this leaves question of how do more colony's get formed? Some colony's have more than one queen, some times in the 100's, this can be seen in Fire ant species which can have 20 or more queens each capable of producing and maintaining about 25,000 worker castes.
I forgot one thing, Female alates, or Queens remove their wings once they are mated.
I could go on, but I have chores to do