In a race car rear wing with 2 airfoils, why does the second airfoil have a greater angle of attack compared to the leading airfoil? Also, what is the best offset distance between the 2 airfoils in a racing car rear wing?
For the same reason that the rear airfoil in a tandem wing airplane or a contra rotating propeller will have a higher geometric angle of attacks than the front airfoil:
The trailing airfoil sits in the downwash of the leading airfoil and therefore will experience a reduced (aerodynamic) AOA if the geometric AOA is the same. Therefore, if you want the trailing airfoil to have the same lift productivity as the leading airfoil then you need to compensate for this by increasing the geometric AOA so that they both experience the same aerodynamic AOA.
As for offset, I don't think it is as simple having a best offset. Even three chord lengths away there is still a lot of downwash. Even on a tandem wing airplane the rear airfoil is still in the downwash of the leading airfoil.
Airfoil creates lift (or in this case downward force) by bending the airflow downward, (upward here).
The lift coefficient and hence lift force is almost linearly proportional to the angle of attack up to approximately 10 degrees.
So the second airfoil needs to pitch a bit more to keep the same angle of attack with a relative wind that is already bent by the first airfoil.
The offset distance is determined in a wind tunnel.