I get confused between the verbs legen and liegen. I would appreciate some explantation on the meaning of the two verbs, preferably with examples. Also, are there context where te two verbs are synonymous?
The difference is that
liegen is used to describe where something is located while is used
legen to describe the act of placing it. For instance you would have:
The rug lies on the floor.
Der Teppich liegt auf dem Boden
But if you were talking about placing the rug on the floor, you would say:
I lay the rug on the floor.
Ich lege den Teppich auf den Boden.
In the first example, notice that you use an indirect object to describe the location, but in the second you would use the accusative for both the object being positioned and the location.
Glenn's answer is pretty much spot on. I would like to add that when you place something such that it has a tendency to be tipped over (vase etc) 'stellen' is more appropriate than 'legen'. But yes, the pairs liegen/legen & stehen/stellen are analogous.
As per their usage in a sentence, legen is a Bewegungsverb (movement verb) like 'gehen' and liegen is Nicht-Bewegungsverb (non-movement verb) like 'schlafen'. Therefore, you have to use accusative and dative cases in Wechselpräposition as well as 'sein' and 'haben' as helping verbs in perfect form respectively.