There is no explicit formula for tension; it is basically a reaction force that occurs on strings, ropes, etc. in the opposite direction when you apply a force in some direction. You kind of have to consider the context first. Let's take this as an example.
If the Free-Body Diagram is drawn as follows:

WW is the same as, let's say F_gFg, for the force due to gravity.
When F_gFg acts on the person, it weighs down the string, and creates tension along it in both directions. This person is weighing down the string by 5^o5o from the horizontal.
Assuming static equilibrium, examining only the part of the string with the man on it (the exact center), and summing the forces in the y-direction (up = positive y, right = positive x):
sin(5^o) = (T_y)/(T_R) = (T_y)/(T_L)sin(5o)=TyTR=TyTL
=> T_y = T_Rsintheta = T_Lsintheta⇒Ty=TRsinθ=TLsinθ
where T_yTy is each individual upward contribution of the tension.
sum F_y = T_(y,"left") + T_(y,"right") - F_g∑Fy=Ty,left+Ty,right−Fg
= T_Lsintheta + T_Rsintheta - F_g = 2Tsintheta - F_g=TLsinθ+TRsinθ−Fg=2Tsinθ−Fg
F_g = 2TsinthetaFg=2Tsinθ
T = T_L = T_R = F_g/(2sintheta)T=TL=TR=Fg2sinθ
So, if the person's mass was 60 kg60kg, then:
F_g = mg = (60kg)(9.807m/(s^2)) ~~ 588.42 NFg=mg=(60kg)(9.807ms2)≈588.42N
Thus, to counter a downwards force of 588.42 N588.42N with only a 5^o5o sag, the tension along the string in each direction is:
color(blue)(T) = (588.42 N)/(2sin(5^o)) color(blue)(~~ 3375.7 N)T=588.42N2sin(5o)≈3375.7N
Other more detailed examples can be found here. The ones with pulleys are the most difficult.