This is a difficult question. Every situation is different. But I do think there are a few guidelines that we can use.
It is appropriate to leave a church when that church becomes apostate.
When cardinal doctrines of the faith are denied, such as the Trinity, justification by faith, the deity of Christ, the inspiration of Scripture, etc. it is definitely time to go.
Sometimes it is appropriate to leave a church when you must move.
Many times it becomes necessary to move to a new location for various reasons, including, but not limited to; ministry, vocation, or family. At these times it is always appropriate to leave the church in good standing and unite with a likeminded body of believers as soon as possible. Healthy advice before making any type of move is to check out the churches in the area before you look at jobs, schools, houses, or any other thing.
It is appropriate to leave a church when it becomes apparent that you can no longer coexist in the body without contention. This is not an excuse for anyone to leave their church.
On rare occasions it is best for the unity of the local body for a fellow believer to leave. Obviously the first option in any situation is to seek some sort of restoration. However, in some cases it is impossible to come to an agreement to disagree. When those disagreements interfere in the worship of God, the fellowship of the body, and Christian unity, it may be time to go.
Obviously, in all of these situations discernment is key. One of the signs of an unhealthy spiritual life is church-hopping, going from church to church based upon "the Spirit's leading". The rule of thumb is, stay where you are. If it becomes necessary to leave a church, do it reluctantly. But leaving just because you don't like some decisions that were made is not a very good reason.