How do we know how to translate ancient languages that are no longer used like The language from ancient Egypt? And what would we need to find in order to understand other ancient dead languages?
Most successful decipherments have required at least one of the following:
At least a limited understanding of the language(s) used in the texts - Examples include Linear B (Mycenaean Greek) and Maya hieroglyphs (Classic Maya).
Bilingual or multilingual inscriptions - Examples include Egyptian hieroglyphs (the Rosetta Stone and the Philae obelisk), Anatolian hieroglyphs (Karatepe bilingual), and Mesopotamian cuneiform (the Behistun inscription).
Some decipherments were aided by both. The decipherment of Maya hieroglyphs benefited from the discovery of a somewhat inaccurate alphabetic key made in the 16th century, for instance, and Champollion's knowledge of Coptic – a late form of the ancient Egyptian language – proved useful in deciphering Egyptian.
In the cases where we do not know or understand the underlying language(s) and lack bilingual inscriptions, decipherment is exceptionally difficult if not impossible, particularly if the corpus is very small. There are quite a few writing systems that are still undeciphered for this reason, including Cypro-Minoan, the Indus Valley Civilization (IVC) script, Proto-Elamite, Linear Elamite, the Byblos syllabary, and Linear A.
Sometimes historians understand the writing system used for a text but not the language in which the text is written, and here again a bilingual inscription is very useful. For example, cuneiform was deciphered in the 19th century, and Assyriologists had a reasonably good understanding of Akkadian and Sumerian by the early 20th century, but some of the other languages written in cuneiform were much more poorly understood. Hurrian, for example, was long known almost exclusively from a diplomatic letter discovered in Egypt, which prevented scholars from being able to make much headway in translating Hurrian despite being able to read the phonetic signs. It was only with the discovery of bilingual Hittite and Hurrian texts in Turkey in the 1980s that Assyriologists were able to begin to start decipherment in earnest, a process which is very much still underway. Hittite itself was deciphered partly due to the discovery of bilingual Akkadian-Hittite texts and partly because it is a member of the fairly well understood Indo-European language family rather than a language isolate like Elamite and Sumerian.
There's always more to be said on the topic, but I wrote about the decipherment of cuneiform and the evolution of our knowledge of Akkadian and Sumerian in this thread and about decipherment in general in Why haven't we deciphered Indus Valley Civilization script yet?
For further reading, Andrew Robinson's The Story of Writing and Lost Languages are great overviews of the decipherment of ancient writing systems.
/u/keylian has previously answered How do we know the pronunciation of very old words from languages that are extinct by now?
/u/Osarnachthis has previously answered How much did the discovery of the Rosetta Stone, and ensuing decipherment of hieroglyphics, revolutionize what was previously understood about Ancient Egypt?