How do you know where to put the stress in a Spanish word or when and where to write an accent over a vowel?
The rules in Spanish are few and clear on this subject. With only a couple of examples, you will be on your way to mastery of this subject. First, however, let’s start with this very important observation about languages in general: they existed before there was a written system for preserving them. You could object to this observation about Spanish, if you recall that it evolved from Latin, which certainly did have a long history and written records as Spanish was developing. However, Spanish, like the other Romance Languages (so called not because they are “romantic" in a loving sense, but because they evolved from the language of the Romans) were vernaculars, vulgar (that is, common) languages with little or no official status until the 1300s or so. Latin was the language of the Church in the West, the language of learning and international diplomacy. The fact is that Spanish did not begin to consolidate its rules for spelling or punctuation until the early 1700s when the Royal Academy of the Spanish Language was created. The first dictionary was produced in the 1720s.
So, the language existed and established itself quite firmly before definitive rules about spelling and accent marks were formulated. The next thing to remember is that the written system for languages with alphabets can opt for two guiding philosophies: etymological spellings or more phonetic ones. English tends to be conservative in that the spelling of English words reflects their origins to some extent, particularly in the case of words derived from French or Anglo Saxon. Spanish opted for a phonetic approach.
You will probably be relieved to learn that Spanish only uses written accents to show stress, not vowel quality (i.e., the manner of articulation). The rules given here and the names for the first two types of words (llanas or graves, and agudas) are very important for your future study of Spanish poetry, but they are the words used to describe the two most common types of words in Spanish when it comes to which syllable receives the stress.
There are four rules which account for most, but not all, of the use of written vs. non-written accents in Spanish. Learning these rules, memorizing a handful of examples for each one, and incorporating them into your daily pronunciation practice will help you a great deal.
1. Words ending in vowels, «n» or «s», called «llanas» or «graves» in Spanish. These words comprise the bulk of the language and are pronounced by stressing the penultimate (next-to-the-last) syllable and bear no written accent.
Examples: competitivo, negocio, artista, hablas, hablan, grave...
2. Words ending in consonants other than «n» or «s», called «agudas» in Spanish. These words are also so numerous that by convention, no written accent is employed. They are pronounced by stressing the ultimate (last) syllable.
Examples: animal, hablar, comer, vivir (i.e., all infinitives), ciudad (and all words ending in «-dad»), multitude (and all words ending in «-tud»).
3. All exceptions to rules one and two employ a written accent and are pronounced by stressing the vowel bearing it.
Examples: carácter (but note, oddly enough, not caracteres), árbol, nación (and all words ending in «-ión»
4. Monosyllabic homonyms, i.e., one-syllable words which in written form are otherwise identical except for the accent, but require a written accent to distinguish their meaning and part of speech.
Since a one-syllable word cannot be stressed on any other than its one syllable, this feature does not affect the spoken, but only the written language.
Examples: el vs. él; tu vs. tú; te vs. té; si vs. sí; mi vs. mí; se vs. sé.