Muslims believe that Allah is the One who gives and that it is He who takes away; He is testing humankind. Hence, a Muslim submits himself to Allah and is grateful and thankful to Allah for whatever he or she is given. On the other hand, he or she is patient and says this expression in times of turmoil and calamity.
A brief (grammatical) dissection of the phrase, for understanding the words better (and not mixing them up or mispronouncing them):
Inna: Inna is really inna-na. The first part is “verily”, the last part is “we”–but Arabic tends to simplify, so it is written as inna (with only 1 noon and shadda for stress). It means “Indeed, we” or “verily, we”.
Li-llahi: Li is a harfu jarr (preposition) meaning “to” or “is for.” It is used as a kind of possessive case. “a laka akhun” (the la is really the same as li) means “is for you a brother?” or “do you have a brother?” So here, “lillahi” means “belong to Allah” or “are for Allah”. (It’s also because of the li that Allah takes kasra.)
Wa: Wa means “and”.
Ilay-hi: This is two parts, it means “toward him”. Ilay is actually a form of ila (a preposition), which means “to”. A grammatically similar phrase is “thahabtu ila masjidin” — "I went to a masjid". “Hi” is actually “hu“, the third-person possessive pronoun (”his”). (It takes kasra because of "ila".) So the overall translation is “toward him”.
Raji3oon: This is a form of raja3a, "return" (the 3 represents the letter 'ain, which is voiced with a tightened throat). Raji3 is a noun/adjective form, meaning 'a person who is returning'. The oon at the end makes it plural (so that it refers to 3 or more people). Raji3oon basically means 'returners', or better 'returning ones'.
So taken together, the phrase can be translated as “We indeed belong to Allah, and we indeed toward him are returning.”