Normally drone races are organised by clubs and associations. In such cases, they may have received operational authorisations from their National Aviation Authorities in accordance with Article 16 of Regulation (EU) 2019/947, which also covers the organisation of such events.
If there are spectators, the operation falls into the ‘specific’ category, and you need to apply for an authorisation from the National Aviation Authority
Is flying with goggles (first person view) authorised in the 'specific' category?
The Regulation allows you to fly without keeping direct eye contact with the drone, provided you have a person next to you, a UA observer, keeping direct visual contact with the drone, scanning the airspace to make sure that you do not endanger other parties (e.g. aircraft or buildings or persons). The UA observer must be located alongside you so they can immediately communicate with you in case they see an obstacle, and give you instructions, such as to immediately land the drone.
Regulatory reference: Article 4(d) of EU Regulation 2019/947
Are spectators allowed in the 'specific' category?
If the event is organised by a club or association that received an authorisation from the National Aviation Authority, or the organiser received an operational authorisation for an operation in the ’specific’ category, then spectators are allowed.