The shape of a freely hanging massive rope in gravity is a catenary. Parabola comes as a natural guess to early learners. Even Galileo once thought it to be a parabola.
Tension is varying at every points but calculation of tension at end points can be done by force balance equations. $$Derivation:$$ Consider a freely hanging massive rope with uniform linear mass density $ {\lambda}$. Let $x$ and $y$ axes represent horizontal and vertical co - ordinate axes. Point$(0,0)$ be the lowermost point i.e. the point where $\frac{dy}{dx} = 0$
Observe : By horizontal force balance horizontal component of tension is same everywhere. Assign it a variable $T_H$ which can be calculated easily by vertical force balance at the end points and torque balance equation about center of mass (You will need this equation in calculation of $T_H$ in asymmetrical case.)
Between any arbitrary $x$ and $x+dx$: $$T_H \left(\frac{dy}{dx}_{x+dx} - \frac{dy}{dx}_x\right) = {\lambda}dsg$$ Since, $$ds^2= dx^2+dy^2$$ $$or , ds = dx \sqrt{1+\left(\frac{dy}{dx}\right)^2}$$ The above given equation becomes - $$T_H \left(\frac{dy}{dx}_{x+dx} -\frac{dy}{dx}_x\right) = {\lambda}gdx\sqrt{1+\left(\frac{dy}{dx}\right)^2}$$ $$or, \frac{d^2y}{dx^2}=\frac{{\lambda}g}{T_H}\sqrt{1+\left(\frac{dy}{dx}\right)^2}$$
Now to further progress from here , making use of $u$ substitution , put $\frac{dy}{dx} = u$. $$\frac{du}{dx} = \frac{{\lambda}g}{T_H} \sqrt{1+u^2}$$
The solution of this differential equation is - $$u = \sinh \left(\frac{{\lambda}g}{T_H}x\right)$$ and thus applying proper boundary conditions- $$y=\frac{T_H}{{\lambda}g} \cosh \left(\frac{{\lambda}g}{T_H}x\right) - \frac{T_H}{{\lambda}g}$$
See , the given equation is for symmetrical case . By making the situation asymmetric there will only be difference in boundary conditions.