If we want to filter a digital signal let's say through an RC circuit, can we treat it as a sine wave? For example, if there is a 100 kHz clock, my guess is that we can't treat it as a 100 kHz sine wave but we need to perform Fourier analysis and find the frequency spectrum and then work with the dominant frequencies. Furthermore, what role do rise/fall times play in this analysis?
You can treat the square wave as a combination of an infinite number of sine waves. So, a 100 kHz square wave and a 100 kHz sine wave share the same 100 kHz fundamental frequency. But, what makes the square wave square is the additional sine wave components.
If you run a square wave through a perfect brickwall filter, all frequencies above the cutoff (or corner) frequency will be filtered out, and the square wave will just look a little less sharp. Move the corner frequency to 101 kHz and it just looks like the sine wave. But, filters aren't perfect, usually it will just attenuate the higher frequencies and not kill them completely.
For rise/fall times, this video might be of interest:
Basically, the faster the rise/fall time the higher the frequency component. So, filtering a square wave will slow down the edge speed. Also, if you're looking at the signal with an oscilloscope or multimeter, that scope/multimeter's bandwidth is basically a filter, so you may not see the exact representation of the signal.
A square wave is an infinite sum of sine waves. You can put it through a filter, and the waveform will be distorted.
If you put it through a low pass filter, the higher frequency sines will be filtered out, and you'll be left with everything below the cutoff frequency. This will look like a square wave with long transitions and ringing on the corners.
I assume you define a digital signal as one that only has 2 amplitude levels as opposed to a sine wave which takes on all levels between its peak values. The spectrum of a sine wave is a single value at the frequency of the sine wave. For a perfect square wave, the spectrum consists of the primary frequency plus all odd harmonics. The level of the harmonics decrease as the number of the harmonic increases. If the rise/fall times are not zero, which is true of all real signals, then the relative levels of the harmonics will change. You can look up these levels by researching Fourier series, especially for a trapezoidal waveform which is the shape of a square wave with non-zero rise/fall time. If the fall time is not equal to the rise time, then the situation gets more complicated. For most filtering purposes, however, if the rise/fall times are small compared to the period of the square wave (say no more than 5%) then the effect on the harmonic levels is small and probably does not have to be taken into account when designing a filter.