In a lecture, my professor mentioned that $\cos$ has two frequencies. I see that using the inverse Euler's formula we can express $\cos$ as a some linear combination of complex exponentials, each with a $\omega$ term. But, I don't really have an intuitive understanding of what it means for a function to "have" a frequency. What other functions have a frequency, and why?
I understand that "to have frequencies" can be misleading. This is a shorthand for "having non-zero energy or amplitude at two (specific) frequencies". Rephrased, for the cosine: when a cosine signal is represented in the frequency domain, it has two non-zero components at frequencies $\pm \omega$, and the other values anywhere on the frequency axis have zero amplitude. Or: its frequency spectrum has only two non-zero values.
Frequency in signal processing often refers to a domain of analysis well-suited to certain signals and systems (linear systems for instance). With Fourier analysis, such signals can be represented as a weighted sum of sines or cosines, and essentially the frequencies a signal has is directly related to the number of sines/cosines with non-zero weight in the sum. One could be more precise, depending on which type of signal and Fourier transformation one is talking about (discrete/continuous).
The concept of frequency is somehow independent on the signal, just like the time, and time and frequency are interlinked via Fourier transforms. So "having frequencies" by itself has no meaning for a signal, just as "having time". But a signal can be described with either amplitudes in the time domain, or amplitudes in a frequency domain.
In that sense, whenever a Fourier transform is properly defined for a signal (integrability, etc.), and there is at least one non-zero value, the signal "has frequencies".
So, most signals you will meet have frequencies, except the zero signal, and those whose Fourier transform cannot be defined correctly. As you might see later in signal processing lectures, one often uses "having frequencies" in a loose sense, meaning "above a certain threshold" instead of being simply non-zero, as in DSP practice, it is rare to have exactly zero values (finite signals, approximations, etc.)
Let's first consider periodic signals. Under rather mild conditions, a periodic signal with period $T$ can be represented by its Fourier series:
Eq. $(1)$ shows that the periodic function $f(t)$ is represented by a sum of weighted complex exponentials with frequencies $\omega_k=2\pi k/T$, which are integer multiples of the fundamental frequency $2\pi/T$. So $f(t)$ has an infinite number of discrete frequencies, unless it is strictly band-limited, in which case the number of discrete frequencies is finite.
For non-periodic functions, again under rather mild conditions, there exists a representation known as the Fourier integral:
The weighting $F(j\omega)$ is now a function defined for all frequencies $\omega$, and it is known as the Fourier transform of $f(t)$. Eq. $(2)$ shows that $f(t)$ has all frequencies for which $F(j\omega)$ is not equal to zero. So generally, a non-periodic signal contains a continuum of frequencies.