As with bugs in general, nobody sets out to write flaky tests.
Sometimes organizational imperatives like code coverage goals can result in less-than-stellar tests. Sometimes a developer doesn't understand the system well enough, and sometimes (often, in my experience) something outside the logical scope of a test changes, e.g., an underlying implicit dependency.
Even a test that is 100% reliable today may become unreliable tomorrow.
Sometimes organizational imperatives like code coverage goals can result in less-than-stellar tests. Sometimes a developer doesn't understand the system well enough, and sometimes (often, in my experience) something outside the logical scope of a test changes, e.g., an underlying implicit dependency.
Even a test that is 100% reliable today may become unreliable tomorrow.