Katakana is the set of characters that is used to form words that have foreign origins. Non-Japanese names are written in katakana. Sometimes it is also used as a replacement for "difficult" kanji or for emphasis. Animal and fruit names are often written in katakana for these reasons.
Katakana is like hiragana in that every basic character has the exact same sound as its name. However, since there are more sounds in foreign words than in Japanese, katakana has more characters and combinations than hiragana does. One important character that is only used in katakana is the chouon.
The spelling of katakana words of foreign origins is supposed to be based on pronunciation. The sounds are generally matched to words as most Japanese hear them. Unfortunately, there are some limitations. Aside from the character n, every character in katakana is made of a vowel attached to a consonant. This means that where there should be two consonants next to one another in a foriegn word, there is a vowel between them in the Japanese version of the word. Also, since Japanese has only five vowel sounds, and a limited number of consonants, substitutions are often made with the "closest" sound, sometimes making the words sound very little like the original. There is also the problem that some katakana words have been based on the spelling of the word instead of the pronunciation.
Please note, also, that NOT all words in katakana come from English. In recent times, the majority of imported words in Japanese come from English, however, this was not always the case. There are many words that have been imported from Portuguese, Dutch, or German. There are, for example, two words for "glass" in Japanese. One is garasu and the other is gurasu. Garasu comes from Dutch, and means only glass the substance. Gurasu comes from English and means only 'a cup made of glass.'
Remember that katakana words are not actually the words that they are based on. Try not to be tempted to use their original pronunciation as a substitute. Often, the original word sounds so different from the Japanese version that it is completely unrecognizable to Japanese ears.
Some general rules for rendering English words into katakana:
In words that contain an r sound after a vowel, the katakana word usually just extends the vowel sound.
The v sound is generally replaced by the b sound.
D and t, when they do not have a vowel after them, are usually replaced with do and to, respectively.
The "j" sound, when it doesn't have a vowel after it, is usually replaced with ji.
The other single consonant sounds, when they do not have a vowel after them, are usually replaced with the appropriate consonant followed by u. (Some notable exceptions to this are the words cake and steak, which turn into ke-ki and sute-ki.)
L and r are both replaced with characters from the ra ri ru re ro line of the katakana table.
The "see" sound is generally replaced with shi. (The newer combination of a se or su character followed by a half-sized u is used in some words.)
The tu sound is generally replaced with chu. (The newer combination of the to character followed by a half-sized u is used in some words.)
The soft "th" sound is replaced with characters from the sa shi su se so row of the katakana table.
The hard "th" sound is replaced with characters from the za ji zu ze zo row of the katakana table.
Since the only w sound in Japanese is wa, all other w sounds are generally replaced with u.
Words that have a short vowel followed by a consonant will often double the consonant. (This is not the case when the consonant is n.)
The "y" sound, except when followed by a, o, or u, is usually replaced with i.
In order to make foreign words sound more like their originals, additional character combinations have been introduced. These new combinations represent fa, fi, fe, fo, si, ti, tu, di, du, wi, we, wo, va, vi, vu, ve, vo, tsa, tsi, tse, tso, che, she, and je. This means that words that came into the language earlier will sometimes follow different spelling rules than words that have been introduced more recently. Unfortunately, most Japanese people do not actually pronounce some of the new characters as they are intended to be used (especially the characters with v and w). So, the spelling has become more complicated without making the pronunciation much better. Some words even have more than one acceptable spelling now.
Ex: fork -> ho-ku ホーク (old ho spelling)
Now that we've gotten all that tedious explanation out of the way, let's get on to actually writing the characters.