This is an Orobanche, we also call it Broomrape. These are parasitic plants that cannot photosynthesise and thus attach themselves to a suitable host plant. At first they grow underground. The flowering stalks only appear after the plant is well established and the seeds can wait ages until they germinate which is caused by the sécrétions of a suitable host plant, which the host plant secretes to create an environment for friendly michorizae. These are quite common round here and often attach themselves to broom, hence the name.