ようだ basically just means "looks/sounds/seems". まるで is a guiding adverb that indicates the following part is not a real description but a figurative/metaphorical expression.
The use of まるで may or may not change the meaning of the sentence. For example, 夢のようだ and まるで夢のようだ are usually not very different because 夢のようだ is almost always a figurative expression said when something wonderful happened in reality. Here, まるで does nothing but adding a small emphasis.
On the other hand, the two sentences you gave are very different in meaning.
It's as if he knew the answer.
He seems to know the answer.
Sentence 1 means he doesn't actually know the answer, while Sentence 2 means he probably knows the answer. Here まるで indicates 答えを知っている is not a true description. In English, this is done by "as if" or "as though".
Sometimes, a sentence using ようだ may look ambiguous (to English speakers). For example, 彼は死んでいるようだ may mean "He looks as if he were dead" or "He seems to be dead" depending on the situation. With まるで, the sentence will only mean the former. But when he is clearly alive and everyone knows 死んでいる is merely a figure of speech, まるで is not necessary nor important.