I have a doubt, I want to understand how this works. Why is the formula like this? Hope you can help me, sorry for my bad English.
The formula is true if and only if the pulley is massless.
The net force on the pulley must always be zero. If the net force weren't zero, the pulley would have infinite acceleration (because it is massless).
To ensure that the net force is zero, the total downward force must be equal to the total upward force.
total downward force = $T_2$
total upward force = $T_1 + T_1$
They should be equal, hence,
$2T_1 = T_2$