Usually when you use “and” with “to be” you need to use the plural form of the verb, such as:

A dog and a cat are outside.

However, when you use “There” with “and” after the verb this is not always true.

There were two dogs and cats outside. (correct)

There was a dog and a cat outside. (also correct)

The reason for this (as I noted in an earlier post) is that the second sentence is short for:

There was a cat outside, and there was a dog outside.

The answer to this problem is that you need to look at the first noun of the subject. If this noun is plural, the verb should be plural and vice versa. This also applies to subjects connected by “or”:

There is a fly and some mosquitoes in the room. (fly is singular)

There are some mosquitoes and a fly in the room. (mosquitoes is plural)

There is a pen or two pencils in the drawer. (pen is singular)

There are two pencils or a pen in the drawer. (pencils is plural)