(Newbie question) Calculating the frequency spectrum
I'm almost tempted to answer with a counter question: what is frequency? It's a question I like to ask students that have already taken signals and systems courses and it's surprising how often they don't know what to answer.
While the whole answer involves some more discussion, what we can definitely say is that frequency is associated to a rate of change of the signal. That automatically means that looking at a signal in one moment of time makes it impossible to say anything about its frequency content, because we cannot see how rapidly it changes.
Therefore, most of what you say is true: a frequency analysis only makes sense for a certain window in time. One can use sliding windows, typically one defines some overlap between adjacent windows, depending on what exactly one is after. The length of the window is a trade-off: longer windows will give you a better frequency resolution (watching the signal change over a longer period of time makes us more certain how exactly it varies) but less resolution in time (if the frequency content changes over time, we may want to be sensitive to that change and if a change is so sudden it appears within one window, we might miss it).
For the borders, it depends what you know about your signal. Either you clip them, or you pad them with something that is meaningful. This can be zeros, it can be a mirrored image of the samples you know (this is more common in image processing), it can be a periodic copy of the end (this is done in communications for other reasons). In most cases, signals are long enough so that we don't need to worry about the edges that much.
As for your last question, I'm not sure I get what you mean by overall occurences. But of course you could average your windowed spectra to get an &quot;average spectrum&quot;. This is referred to as Bartlett's method, some sources call this the periodogram (careful, the term is used in conflicting manners in the body of literature).