Do you play an upbeat like this when beginning the song, and then also at the end?
The upbeat is where the song starts.
Imagine starting the song "Happy birthday to you" without the upbeat; then you would start singing "birthday to you". When you reach the end you don't play the upbeat of the song. Imagine ending "Happy birthday to you" by singing "Happy".
So the upbeat is part of the song, starting the song, and should be played at that point.
This is also called pickup note, pickup measure or anacrusis. You can read about it here: Wiki
You can find them in a lot of songs, like Happy Birthday for example:
Of course you don't have to use any pickup measures in your songs if they don't need one.
However, if you use them, be sure to subtract the note duration of your pickup measure from the last measure of your song, because the pickup + the last measure together have to be a complete measure of the time signature you're using.
So the example in your book shows... If you're using 4/4 as your time signature and your pickup measure has a note duration of a quarter note, your last measure has to have only a note duration of 3 quarter notes to get a full measure of 4/4.
Upbeats (as written in the OP) are played as if they were the last beat(s) of the pickup measure. In the posted piece, one can imagine (but not play) the 3-beat rest before the quarter note. The point is to begin a melody on an unaccented beat.
There need not be anything at the end of the piece to make up for the upbeat. In some styles (older but not outdated) of notation, a three-beat (in this case) measure appears at the end to balance out the measures. As three rests at the end of a piece do not represent a sound, the modern practice is to leave them out.
It makes more sense when words are involved. The upbeat is often a less emphasised word than the one following it - which needs to be emphasised. Happy birthday to you. My bonnie lies over the ocean. Oh, say can you see (by the dawn's early light).
In order to get the emphasised word in the right place in the bar at the beginning (and anywhere else in the song!) it needs to be written with that upbeat. Sometimes it's several notes. And did those feet (in ancient times). So yes, if it's written, it gets played.
Usually, because a song is more than one verse, the last bar compensates for the anacrusis (pick-up, or in the OP's case, upbeat) by being short by that amount. It makes it easier to sing when looped round - it keeps the song, and those singing it, in time. So the last bar here has only three beats, so when it gets repeated, the fourth (last) beat gets played for the beginning of the next verse. In this song, the upbeat is an A, the 5th of the key, D, so it leads naturally into the next verse - so - of course, on the last verse, it would be silly to finish on the upbeat of the next verse - which doesn't exist then...
The notes are played in the order they appear.
This is explaining that sometimes the first bar doesn't always have as many beats as appears in the time signature. In this case you can imagine counting (1) (2) (3) , but the one, two and three are silent, and you start playing on the 4 beat. It is not necessary to actually pause for 3 beats. Just start playing on the 4.
The second sentence points out that often the last bar will have as many beats as are missing from the first bar. For the last bar, you can imagine counting , , , (4), but the 4 is silent. This is the opposite of the first bar.
But there is no suggestion that you would append the first bar to the last bar in order to make up a full 4 beats. It's just an observation that there are often as many beats missing from the last bar as there are in the first bar.