Integral of trig functions over a period

Can somebody please explain to me why the integral of, for instance, cos((2*pi*x)/a)*cos((4*pi*x)/a) vanishes over the interval 0 to a? As I understand it, this is generally the case when integrating sines and cosines with different arguments "over the interval of a period." But I'm confused about why this is the case. Is there a straightforward argument. (I know it can be derived using complex exponentials, but I'm wondering if there is some kind of intuitive understanding of the graphs, like maybe using the properties of even and odd functions?) Also I'm somewhat confused about what it means here to "integrate over a period," since the interval from 0 to a, in the above example, is technically the full period of the first cosine, but only half that of the second, right?

Try splitting the longest period in half and doing the integrals separately for each half. Provided all other periods properly divide the longest one, the integrand at a given point in in the second half should be the negative of the integrand at the corresponding point in the first half.

What does it mean to "properly" divide? And why is it that taking the product of sines and cosines with different arguments generally yields an "odd" function. Is the resultant product always odd about a particular axis? How do you find that axis? I don't know why, but I find this property bewildering.

... what it means here to "integrate over a period," since the interval from 0 to a, in the above example, is technically the full period of the first cosine, but only half that of the second, right?.

You are talking here about periodic functions. That means there is a period for which, the whole function is simply a repetition of that part of the function. For example, for sin(x) the period is 2π. So any interval of 2π, such as x=0 to x=2π, or x= π to x= 3π, or x=0.3 to x= 0.3 + 2π, or x= -1.9π to x= +0.1π, etc give a portion of that function, which if repeated end to end for ever, gives the whole function. So it does not matter where you take this slice of the function, so long as its length is equal to the period. You can see this easily for the sine function.

You can also see for the sine function that, over the length of a period the positive part exactly equals the negative part. So that if you integrate sine over one full period (or cycle) the sum will always be zero. Over several full cycles you get several x zero, which is still zero.
This is true for any sine: you just have to use a complete period (or cycle). For example, if you have sin(ax +b) the period of sine is 2π,
so the period of sin(ax + b) is from ax + b = 0 to ax + b = 2π which means from x = -b/a to x = (2π - b)/a , or from x=0 to x= 2π/a , or x= -π/a to x= +π/a, etc.
So this function has a period of 2π/a because that is the change in x which produces the repeating unit of this function, (no matter where you start the slice.)

The next thing to realise is that any sum of sines will be periodic. That includes cosines of course, because they are just phase shifted sines: cos(x) = sin(x + π/2)
The period of a sum of sines may change from that of the individual sines. For eg. sin(3x) has period 2π/3 and sin(5x) has period 2π/5 , but sin(3x) + sin(5x) has a longer period 2π
That is the answer to your question about sin( 2πx/a) and sin(4πx/a) The period of the combined function is a. The second sine completes two cycles in that time, but the first sine completes only one cycle in the same time. The period of the combined function is the shortest time which allows all components to have a complete number of cycles and the combined function to complete one cycle.

BTW It does not make any difference if the sines have different phases and amplitudes. 1.7sin(x + 0.3) has period 2π just like sin(x).

Now when you integrate a sum of sines, that is the same as the sum of the integrals of the sines. So provided the integral is over at whole number of periods for each individual sine, those integrals are all zero and the sum is zero. The longer period of the sum of sines simply represents the fact that each sine must have a whole number of cycles in that period. So in period 2π, sin(3x) has 3 complete cycles and sin(5x) has 5 complete cycles, but there is only one complete cycle of the combined function sin(3x)+sin(5x)

Finally, even multiplying sines gives a sum of sines, sin(a)sin(b) =sin(a)cos(b-π/2) = 0.5sin(a + b - π/2) + 0.5sin(a - b + π/2)
So sin(10x)sin(x) = 0.5 sin(11x -π/2) + 0.5sin(9x +π/2) which will have a period of 2π because that is the shortest interval in which both these sines can complete a whole number of cycles.

I hope the mathematicians will forgive the sloppy language (and any arithmetic errors) as I'm trying to explain the intuitive idea the OP requests.