How do sidewinds affect forward speed? If I'm riding at 20mph on the flat with no wind, and then a 10mph wind kicks up, if I'm heading directly into it I'll slow down by X mph, and if I'm heading directly with it (i.e. pure tailwind) I'll speed up by Y mph. (As an aside, are X and Y likely to be the same? From experience I'm assuming not)

If this is on a perfectly circular course, is the effect of the side wind (I should have said 'the angle of the wind') smoothly proportional? I.e. assuming constant power output, when doing a lap and so experiencing each angle of wind for the same amount of time, would my speed show a smooth trend from 20-X mph, through 20mph, to 20+Y mph, and then back again, maybe like a sine wave? Or do side winds mess with the cyclist in a way that pure head and tailwinds don't?

For extra credit, do you know where the wind would be coming from for me to be travelling at my original speed of 20mph?
The answer to your questions is not straighforward, as shown below.

The easiest to answer is your first question: are X and Y the same? No, they are not. This follows from the formula for the air-drag power Pa = ½.rho.Cd.V.(V-Vw)² , where rho is air density, Cd is drag coefficient, A is frontal area, V is forward speed, Vw is wind speed.

Suppose that for a certain power input your speed in the absence of wind is V0. 
Now if you keep power constant, we have for a tailwind a forward speed Vt : Vt.(Vt - Vw)² = V0³.
For a headwind we have a forward speed Vh : Vh.(Vh + Vw)² = V0³.

For any V0 and Vw, you can calculate Vt and Vf by solving a cubic equation. It is easy to verify by substitution that for a no-wind speed of 20 mph and a wind speed of 10 mph, the headwind speed becomes 13.95 mph and the tailwind speed 27.16 mph (neglecting rolling resitance). So Y>X.

However, I find it more elucidating to consider a return trip along a road heading straight in the direction of the wind first and returning in a tailwind on the same road. Suppose that the trip without wind takes a time T0. It can be shown that the total time Tw is always larger than T0 and that the ratio Tw/T0 does not depend on A, Cd and rho nor the distance : Tw/T0 = (V0/Vh +V0/Vt)/2. 

A few years ago I made a graph where the ratio Tw/T0 is plotted against the wind speed,  assuming a wind-free speed of 20 mph, shown below.



The graph shows that a wind always increases the return time. At 10 mph wind speed the return time increases by 8.5%. At 15 mph wind, the increase is about 20%. This calculation assumes that the rolling resistance is small compared to the aerodynamic resistance, which is roughly the case at 20 mph. 

Your question about the effect of a side wind is much more difficult to answer, because the wind-exposed area plays a big role. This takes a much more elaborate study. There is a free-access paper on the internet by Osman Isvan that investigates this question in depth.

See research paper Wind speed, wind yaw and the aerodynamic drag acting on a bicycle and rider