What are the conditions under which an eclipse (both solar and lunar) will occur?
They cannot happen at the Same time.
A solar eclipse occurs when the Moon is directly between the earth and the Sun casting it's shadow onto the Earth. How does this happen even though the Sun is 400 times bigger than the Moon. The answer to that is the Sun being 400 times larger than the Moon is also 400 times further away so, they appear to be of the same size.
A lunar eclipse occurs when Earth is directly between the the Sun and the Moon, casting it's shadow onto the moon.