How restricted is the curvature of a manifold by choice of topology keeping the underlying set fixed? Suppose we have a topological manifold, then by varying the connection on the manifold, we can varying the properties related to curvature of the manifold as curvature is solely a property of the connection. This led me to wonder, is there a precise way to describe how limited we are in varying the curvature properties of a topological space as we vary it's connection while keeping the underlying set fixed?
The motivation comes from this post where I ask if it possible to do GR on the basic levels by only using $R^4$ as the base set
. I had the thought after reading what I considered to be a profound point by user Peek-a-Boo:

There is no connection ∇ on the sphere $S^2$ such that the Riemann curvature $R^∇$ of the connection vanishes identically. In other words, the sphere does not admit a flat connection. The plane $R^2$ obviously has a flat connection. So, there are genuine differences in these manifolds; this is just one instance where the topology has implications for the curvature

 A: As people have remarked in the comments, this question is really too broad for a concrete answer. I would suggest looking into Chern-Weil theory, which is the theory of characteristic classes from a differential geometric perspective. Chern-Weil theory tells you that for any closed, oriented Riemannian $2n$-manifold $X$, we can construct the Euler class, which is a cohomology class $e(X)\in H^{2n}(X)$. This cohomology class can be represented by the curvature tensor of the Levi-Civita connection. Namely, $e(X)=[\text{Pf}(\frac{F}{2\pi})]$, where $\text{Pf}$ denotes the Pfaffian of a matrix. The Chern-Gauss-Bonnet theorem states that
$$\chi(X)=\int_X\text{Pf}(\frac{F}{2\pi})$$
On the one left hand side, there is a purely topological quantity, the Euler characteristic. On the right hand side, there is information about the metric. The theorem tells us that geometric objects can tell us about the topology of the underlying space. Conversely, it also tells us that the topology constrains the geometry of the underlying space. In particular, $\chi(S^2)=2$. Consequently, there can be no metric $g$ whose curvature tensor vanishes, for this would contradict the (Chern-)Gauss-Bonnet theorem.
When dealing with surfaces, this can be worked out very explicitly since we will get $$F=\begin{pmatrix}0 & \eta\\ -\eta & 0 \end{pmatrix}$$
in a local orthonormal frame, for some $2$-form $\eta$. Moreover, $\wedge^2T^*\Sigma\cong\Sigma\times \mathbb{R}$, so that $\eta=f\text{Vol}_g$ for some function $f:\Sigma\to\mathbb{R}$. This function is the Gaussian curvature of $\Sigma$, also denoted $\kappa_\Sigma$. We recover the classical Gauss-Bonnet theorem, which states
$$\frac{1}{2\pi}\int_\Sigma \kappa_\Sigma\text{Vol}_g=\chi(\Sigma)$$
From this, one deduces the implications this has for the possible curvatures of a metric on a surface, mentioned by Didier in the comments.
So for surfaces, your question is a piece of classical differential geometry which was already known to Gauss. For higher dimensional manifolds, the question becomes much more difficult. However, there are again no flat metrics on the even-dimensional spheres. Their Euler characteristics are $\chi(S^{2n})=2$. If the metric were flat, then this would contradict the Chern-Gauss-Bonnet theorem.
From the physics perspective, I believe that Kähler-Einstein manifolds are in popular demand. These are complex manifolds which admit a "nice" kind of metric. The existence of Kähler-Einstein metrics on manifolds of a given topological type is an area of research that had a major breakthrough not that long ago, in 2012, through the work of Chen, Donaldson and Sun. So no, in complete generality there is no way to precisely describe the limitations on the properties of a metric, based purely on the topology of the underlying manifold. Even for complex manifolds, which are a very restrictive class of smooth manifolds, this is an active area of research. Answering such questions for even these particularly nice types of manifolds usually involves a heavy amount of analysis (see Yau's proof of the Calabi conjecture).
