It is because the phonetic of 's' is [es] and [e] is a vowel. So in front of a vowel, there need to write 'an'.
If you want to know more, you can go to here: http://www.ipa.edu.hk/index.php
Then click resources to see all the vowels.
Besides, if you want to know the word is vowel or not, you can check the dictionary and look at the DJ.