At first I thought "S" was similar to a glissando, but then there's a spot with an S and a glissando. What does the S mean?
The S probably means "slide" which is another word for glissando. In your example only one of them has a wavy line but they should probably all have a wavy line. In my music notation program it sometimes happens that the wavy line isn't printed if there is a short distance between the notes in which case only the letter or word is printed. Personally I always write the word "gliss." instead of a single letter, because the term "gliss." makes it clear what is intended. Then if the line (whether straight or wavy) isn't printed I spend some time working with the matter until I manage to get the program to print the line.
The 2 S's in measures 29 and 31 may stand for "Subject" which is a motive which is stated and developed throughout the work.In J.S. Bach's inventions he stated a Subject ( or a motive ) early in each piece which was often associated with a complementary motive called a "Countersubject". The Subject and Countersubject would be recurring often in two-part counterpoint.Another famous "S" motive is developed in Ludwig van Beethoven's 5th Symphony...- Da da da Daaa , Da da da Daaa .Just those 4 notes in that one Subject ( motive ) and his 5th Symphony was created. A super theme develops out of 4 simple notes. The Subject = S