Preheat oven to 220°C (200°C fan) mark 7. Roll the pastry out to a rough 30.5cm (12in) square, trim to a circle, then chill in the fridge. Put the shallots into a heatproof bowl and pour over boiling water to cover. Leave for 10min, then drain and peel. Halve any larger shallots so they are all a roughly even size.
Heat the oil in an ovenproof non-stick frying pan (about 25.5cm/10in) over medium-high heat. Add the shallots and fry for 10min, then add the vinegar and sugar and cook for a further 5min, or until thick and syrupy.
Meanwhile, for the herb dressing, finely chop the hazelnuts and herbs, put into a bowl and stir in the capers, vinegar and oil. Set aside until needed.
Nestle the beetroot into the pan among the shallots. Lay the pastry over the vegetables and tuck in the edges. Bake for 35-40min until crisp and deep golden (it needs longer than you might think to cook through). Set aside for 5min, and then tip out on to a serving plate or board. Drizzle with the herb dressing to serve.