An example for this is given in the documentation of chemfig (part III section 12.5 Draw polymer element). There a macro
\makebraces(<dim up>,<dim down>){<subscript>}{<opening node name>}{<closing node name>}
is defined that exploits chemfig's @{<node name>,<pos>} syntax inside formulas to position delimiters on a bond.
The code below is basically a copy from there:
\documentclass{article}
\usepackage{chemfig}
\newcommand\setpolymerdelim[2]{\def\delimleft{#1}\def\delimright{#2}}
\def\makebraces(#1,#2)#3#4#5{%
\edef\delimhalfdim{\the\dimexpr(#1+#2)/2}%
\edef\delimvshift{\the\dimexpr(#1-#2)/2}%
\chemmove{
\node[at=(#4),yshift=(\delimvshift)]
{$
\left\delimleft
\vrule height\delimhalfdim depth\delimhalfdim width0pt
\right.
$};
\node[at=(#5),yshift=(\delimvshift)]
{$
\left.
\vrule height\delimhalfdim depth\delimhalfdim width0pt
\right\delimright_{\rlap{#3}}
$};
}%
}
\begin{document}
\setpolymerdelim()
\chemfig{
CH_2=[:-30]CH-[:30]C(=[:90]O)-[:-30]O
-[@{op,.75}]CH_2CH_2-[@{cl,.25}]
O-[:30]C(=[:90]O)-[:-30]CH=[:30]CH_2
}
\makebraces(5pt,5pt){$\!\!n$}{op}{cl}
\end{document}

The first part of \makebraces(<dim up>,<dim down>) specifies the height of the parentheses (divided in an up and down part). The parentheses can be positioned via the <pos> part of @{<node name>,<pos>}. The fontsize can be changed in the <subscript> part of \makebraces. It could also be hardcoded in the macro itself, of course.
\setpolymerdelim()
\chemfig{
-[@{op,.75}:30]CH_2CH_2-[:-30]O-[@{cl,.5}:30]
}
\makebraces(12pt,12pt){$\scriptstyle\!\!n$}{op}{cl}

To be more flexible one could change the definition of \makebraces to get different upper and lower height for each parenthesis.
Edit in response to edited question:
The code below is a quick modification of the \makebraces command that makes the argument (<dim up>,<dim down>) optional and sets both to 5pt as default for both delimiters. It also introduces a second optional (<dim up>,<dim down>) that when used sets different values for the closing delimiter. For convenience this is done with the help of xparse. This allows for better control of both delimiters.
\documentclass{article}
\usepackage{chemfig}
\newcommand\setpolymerdelim[2]{\def\delimleft{#1}\def\delimright{#2}}
\usepackage{xparse}
\makeatletter
\newcommand\@set@open@delim[2]{%
\edef\open@delim@halfdim{\the\dimexpr(#1+#2)/2\relax}%
\edef\open@delim@vshift{\the\dimexpr(#1-#2)/2\relax}%
}
\newcommand\@set@close@delim[2]{%
\edef\close@delim@halfdim{\the\dimexpr(#1+#2)/2\relax}%
\edef\close@delim@vshift{\the\dimexpr(#1-#2)/2\relax}%
}
\newcommand\@make@braces[3]{%
\chemmove{
\node[at=(#2),yshift=(\open@delim@vshift)]
{$
\left\delimleft
\vrule height\open@delim@halfdim depth\open@delim@halfdim width0pt
\right.
$};
\node[at=(#3),yshift=(\close@delim@vshift)]
{$
\left.
\vrule height\close@delim@halfdim depth\close@delim@halfdim width0pt
\right\delimright_{\rlap{#1}}
$};
}%
}
\NewDocumentCommand\makebraces
{
>{ \SplitArgument{1}{,} } D(){5pt,5pt}
>{ \SplitArgument{1}{,} } d()
mmm
}
{%
\@set@open@delim #1%
\IfNoValueTF {#2}
{\@set@close@delim#1}
{\@set@close@delim#2}%
\@make@braces{#3}{#4}{#5}%
}
\makeatother
\begin{document}
\setpolymerdelim[]
\chemfig[][scale=0.6]{
?(-[2]CH_2-[@{op,.8}:180,3])(-[::-30,1.5]O-[::+60](-[:-30,1.5]O-[@{cl,.8}:0,3])<[::-150,1.5](-[:-50]O(-[7](=[6]O)-[1](-[7]CH_3)=[8]CH_2))-[::-90,1.5,,,line width=3pt](-[:45,1.5]OH)>[::+60]?(-[:-120]OH))
}
\makebraces(10pt,100pt)(46pt,64pt){$\scriptstyle\!\!n$}{op}{cl}
\end{document}
