(variety is singular, so we use "is" instead of "are")
variety of what?
There is a variety of forms.
(we still use "is" because we are talking about "variety," and "variety" is singular; "of forms" is a preposition describing "variety" and does not influence whether we use "is" or "are")
what kind of forms?
There is a variety of forms of apartments.
(in everyday speech, we usually refer to "apartments" in the plural when talking about apartments in general; when referring to a particular/specific apartment where one person lives, we refer to "apartment" in the singular; "of apartments" is describing "forms" and does not influence whether we use "is" or "are")
It might be confusing to accept that "variety" is singular when its meaning refers to a multitude of things or multiple things. The word itself is singular even if its meaning is potentially referring to many things. The plural for "variety" is "varieties." The word comes from French, and Romance languages are known for their abstract ideas and abstract representations while Germanic words are known to be more concrete.