How Automatic Failover Works (AlwaysOn) I'm going to use AlwaysOn technology on my servers, but it's some unclear points in the documentation:

Automatic failover looks like


Primary replica (A) unaccessable
Secondary replica (B) becomes first replica
When A become available it sets to secondary replica and get all changes from primary replica (B)
???


in documentation is written that:


  Later, when the server instance that is hosting the former primary replica restarts, it recognizes that another availability replica now owns the primary role. The former primary replica transitions to the secondary role, and its databases become secondary databases. The new secondary replica connects to the current primary replica and catches its database up to the current primary databases as quickly as possible. As soon as the new secondary replica has resynchronized its databases, failover is again possible, in the reverse direction.


Does it mean that former primary replica (A) will become primary replica automatically? Or it (A) will be secondary and failover in reverse direction must be done manually?

Thanks for your help
Does it mean that former primary replica (A) will become primary replica automatically?


No, all that means is when your replica comes back into the picture, and when the Availability Group database gets back in a SYNCHRONIZED state that it would be failover ready.  That operation will not happen automatically.  You indeed would have to either do this "failback" manually, or engineer a way to automate this (rather simple, let me know if you want to explore those options).

From a high-level view, your listing of steps is complete after step #3.