In the picture, ABCD is a square of side 1 and the semicircles
have centers on A, B, C and D. What is the length of PQ?

The solution says that the triangle AQD is equilateral, then extends PQ and ... But I dont know how ADQ is equilateral .
The line $(PQ)$ cuts $(BC)$ at $I$, and $(AD)$ at $H$. Since $ADQ$ is equilateral, $HQ=a\frac{\sqrt3}{2}$ (use trigonometry or the Pythagorean theorem), where $a$ is the side of the square (here it's $1$ but it doesn't matter). Then $IQ=PH$ by symmetry, and $IQ=a-HQ=a\left(1-\frac{\sqrt3}{2}\right)$, and finally
$$PQ=a-2IQ=a(\sqrt3-1)$$
Remark that by construction you have AQ=DQ. Hence AQD is equilateral. The height QH of this triangle is therefore $\sqrt{3}/2$ (H is where the extension of segment PQ touches the AD segment). Now you can prove similarly that PH' is also $\sqrt{3}/2$ (H' is the point where the extension of PQ touches BC).
Now you know that
$1=DC=PQ+2PH$
and that
$\sqrt{3}/2=PQ+PH$
So you have a system of two equations and two variables.
Solving you find:
$PH=\frac{2-\sqrt 3}{2}$
$PQ=\sqrt 3 -1$