The most dangerous failover is the one where the old primary was not really dead. A network cut can make it look dead to the failover manager while some app servers can still reach it. If the standby is promoted, you now have two primaries, both taking writes. This is split brain, and merging two diverged databases afterwards is slow, manual work.
Two tools prevent it. First, a quorum: the decision is made by a majority of several witnesses (for example three or five members of etcd, ZooKeeper or Consul), so a server cut off from the majority knows it has lost the lead. Patroni's leader holds a lock in that store and must renew it; a primary that cannot renew its lock demotes itself. Second, fencing: before the new primary takes writes, make sure the old one cannot, by shutting it down, cutting it off from its storage, or blocking it at the proxy. The active-passive failover lesson shows how both work together.
After a failover comes failback: the old primary is repaired, rebuilt as a standby from the new primary, and only later, if wanted, made primary again in a planned, controlled switch. Never just restart it as a primary, because it may hold writes the others never saw.