  We study weighted Poincar\'e and Poincar\'e-Sobolev type inequalities with an
explicit analysis on the dependence on the $A_p$ constants of the involved
weights. We obtain inequalities of the form $$ \left
(\frac{1}{w(Q)}\int_Q|f-f_Q|^{q}w\right )^\frac{1}{q}\le C_w\ell(Q)\left
(\frac{1}{w(Q)}\int_Q |\nabla f|^p w\right )^\frac{1}{p}, $$ with different
quantitative estimates for both the exponent $q$ and the constant $C_w$. We
will derive those estimates together with a large variety of related results as
a consequence of a general selfimproving property shared by functions
satisfying the inequality $$ \frac{1}{|Q|}\int_Q |f-f_Q| d\mu \le a(Q), $$ for
all cubes $Q\subset\mathbb{R}^n$ and where $a$ is some functional that obeys a
specific discrete geometrical summability condition. We introduce a
Sobolev-type exponent $p^*_w>p$ associated to the weight $w$ and obtain further
improvements involving $L^{p^*_w}$ norms on the left hand side of the
inequality above. For the endpoint case of $A_1$ weights we reach the classical
critical Sobolev exponent $p^*=\frac{pn}{n-p}$ which is the largest possible
and provide different type of quantitative estimates for $C_w$. We also show
that this best possible estimate cannot hold with an exponent on the $A_1$
constant smaller than $1/p$. We also provide an argument based on extrapolation
ideas showing that there is no $(p,p)$, $p\geq1$, Poincar\'e inequality valid
for the whole class of $RH_\infty$ weights by showing their intimate connection
with the failure of Poincar\'e inequalities, $(p,p)$ in the range $0<p<1$.
