Japanese/Pitch accent

Japanese uses pitch accent, where every mora can either be pronounced with a high or low pitch. Not all dictionaries will indicate this, but pitch accent is certainly important, because it can make the difference between different words.

For example, using bold for high pitches:

いま (今) - "now"

いま (居間) - "living room"

Pitch is, however, to some extent a characteristic of regional accents, so a Kanto speaker may be using the opposite pitches to a Kansai speaker. Where pitch is taught, it will be standard Japanese (essentially the Tokyo dialect). Pitchless Japanese is easily understood by native speakers and incorrect pitch will at most sound somewhat odd. Studying pitch, therefore, isn't essential to the learning Japanese and is perhaps best picked up by conversing with native speakers.

Linguists, however, tend to classify Japanese as having a falling pitch following what is considered the stressed vowel.

Mora Counting
A common misconception is that moras in Japanese are the same as syllables in English. Moras differ from syllables because of how they are counted.

Consonant-Vowel Combinations written as Digraphs count as 1 mora. These are cases where you have き、ぎ、し、じ、ち、に、ひ、び、ぴ、み、り combined with や、ゆ、and よ to form Digraphs like きゃ, しゅ, ちょ, etc.

So, the ちゅ in 中国[ちゅうごく] accounts for 1 mora. The whole word is 4 moras.

A vowel combination counts as 2 moras. Combinations like おう、えい are 2 moras. This also includes a vowel being written or said twice, like おお、いい, etc.

Ex. the せい in the word 人生[じんせい] or the おう in だろう would count as 2 moras.

The mora ん counts as 1 mora

Ex. The ん in 先生[せんせい] is the 2nd mora in the word, and the whole word has 4 moras.

The small tsu (っ) which doubles a consonant adds 1 mora.

Ex. the word 学校(がっこう) has 4 moras.

There is a unique set of mora known as "special mora" (特殊拍) which consist of small tsu "っ", the kana "ん" and long vowel symbol  "ー",  the last high pitch can not occur on any of these "special mora".

This is all important information to know when reading pitch accent, and counting Japanese moras.

Pitch classification
When dictionaries give pitch accent, they'll usually indicate it with a number. The number tells you the mora where the last high pitch is. To figure out the pitch pattern, put a low onto the first mora (unless the last high pitch is on that mora), put high pitches onto all the mora that follows, until you hit the last high pitch. After that, put low pitches.

Even more helpful dictionaries will do all of this work for you, by telling you exactly where all the pitches rise or fall.

So, to give some examples.

Notice how ともだち (0) and おとうと (4) look as though they have the same pitch pattern despite the different numbers. The difference is based on the grammatical pattern like -は added afterward. Therefore, the continuation of both pitch pattern becomes ともだちは and おとうとは.