Here are some of the things I've identified that can cause flaky tests.
A common type of race condition in tests is this: the test submits a form and then clicks a link on the subsequent page. BUT sometimes the page loads a little more slowly than at other times, and so the test driver clicks the link before the link actually shows up on the page. It's a race between the link showing up and the test trying to click the link. In the cases where the click "wins" the race, the test will fail because the link isn't available yet. Other kinds of race conditions exist too but that's a common case.
Let's imagine there's a test suite with just two tests in it, test A and test B. Both tests create a user in the database with the email address "[email protected]". But the difference between the two tests is that test A deletes the user at the end of the test, while test B leaves the user lying around in the database. If test A runs before test B then there's no problem because test A