Overall, all endings in Cyberpunk 2077 boil down to 3 main ones, each of which is divided into two more: one alternative (premature) and one secret.
Attention! We have minimized the number of spoilers in this material, but for obvious reasons, we cannot completely exclude them.
When you talk to Hanako, you will have several options on what to do. The simplest is to trust her and agree to the deal. In this case, V ends up in the Arasaka clinic, where eventually he will be offered a choice: digitize his personality and stay in the storage or return to Night City and inevitably die within six months.
To unlock this option, you need to complete the storyline arc with Panam, that is, complete all her side missions. In this case, V, Panam, and the Aldecaldos clan will storm the Arasaka tower to break into Mikoshi.
Eventually, V will find himself in cyberspace with Johnny and Alt, and here a final decision must be made. As with the first ending, the choice is not easy: return in your own body and die or give your body to Johnny, and remain as part of Alt.
If you return, then V along with the Aldecaldos clan and Panam will leave Night City. If you had a relationship with Judy, she will join as well. If you give the body to Johnny, he will also eventually leave Night City to start a new life.
The ending is similar to the previous one, but now Rogue will be helping you. To make this happen, you need to have a good relationship with Johnny, then there will be an option to take the pills and let Johnny take over the body.
He will come to Rogue to ask for help. Eventually, they will break into Mikoshi together. In the end, a choice will be offered: return in your own body and die or give your body to Johnny, and remain as part of Alt.
Essentially, this is the worst ending. When you are sitting on the roof, where Misty takes you, you can end it all right there. After all, Victor gave you a gun for a reason. But don't expect anything good in the messages from friends that follow the ending.
It's practically impossible to figure it out on your own. But here's what you need to do: on the roof, hover the cursor over the option where V agrees to go to Rogue as Johnny. But do not select this line. That is, in this situation, V is still hesitating and choosing between the gun and the pills that allow Johnny to take over the body.
Wait there for about 5 minutes, after which Johnny will suggest going to Mikoshi on his own, without anyone's help. In this option, none of the friends will die.