The form of the letter Ы is misleading, as it looks like a soft sign followed by I. However, it actually evolved from a hard sign followed by I (ъı) and its form morphed somewhat (see Yery - Wikipedia). Consonants preceding ы are always hard, just as with consonants preceding the vowels о, а, у, э. Consonants preceding the vowels е, я, ю, ё, и are always soft (except in some foreign loanwords with the letter «е»). Consonants preceding other consonants or at the end of words are generally pronounced hard. The exception is if they are followed by the soft sign (ь). The hard sign is normally used to indicate a "break" in the word, as if it were two separate words.

To pronounce a consonant "soft", say it as if you're trying to say a small "y" sound at the same time. Your tongue should be high in your mouth. Hard consonants are the opposite - your tongue should be low in your mouth. This is quite easy with consonants such as «Лл» and «Нн», but not so easy with consonants such as «Рр» (рь can be quite difficult for an English speaker to say - practice with words such as «ребёнок»).