When do you use and when do you use an?

Use a before a consonant sound; use an before a vowel sound.