まるで + [noun] + の + ようだ まるで + [verb (plain)] + ようだ まるで + [noun] + の + ような + [noun] まるで + [noun] + の + ように + [verb]
まるで…ようだ makes a simile: X is just like Y, though it isn't really Y. まるで goes early in the sentence and ようだ at the end; a noun takes の before ようだ, and a verb is in the plain form.
ようだ conjugates like a な-adjective. Before a noun it becomes ような; describing how something is done, it becomes ように.
The polite and past forms follow the same pattern: ようです, ようだった, ようでした.
Without まるで, ようだ is ambiguous: it can also mean "it seems", a guess from evidence. まるで rules the guess out and leaves only the likeness.
In casual speech, みたいだ takes the place of ようだ and a noun drops the の: まるで子供みたい.