One good way to develop this sort of intuition is to spend lots of time searching for the proof prior to reading it - and, perhaps even better, to spend time coming up with conjectures prior to reading theorem statements. This doesn't always lead to a result, but it gives you practice in exactly the skillset you need. It's also often worth reading a proof in a book and thinking, "Oh, I don't get this at all" - and then trying to find your own proof that makes more sense. Either, you'll find that the proof in the book was terrible (which happens a lot) or you'll find yourself forced into the path that the book took - and will hopefully understand the proof better after finding it unavoidable. It's also good to look at bigger theorems and ask yourself how you would prove it from the ground up - because you'll often find that proofs fit together in nice ways.
If you want to prove:
Every compact set $K$ in $\mathbb R^n$ is closed.
You should probably immediately expand this to the start of a proof:
Let $x \in \mathbb R^n\setminus K$. We wish to find some $\varepsilon > 0$ such that $B(x,\varepsilon)\cap K=\emptyset$ given that $K$ is compact.
Then, there's a bunch of ways to go depending on what you know about compact sets, but going with the most literal interpretation, we know that we're supposed to find some open cover of $K$ and then take a finite subcover, but we don't know how that could help us.
However, we might get a hint by asking how this could fail: we would have a problem if there was, for every $\varepsilon > 0$ some $y\in K\cap B(x,\varepsilon)$. Maybe if you have a good mental picture of compactness, your mind will make the leap right here - but if not, you can surely draw some potential counterexamples - just draw a bunch of concentric circles around a point $x$, and put at least one point $y$ in each circle, and ask yourself why this is not compact.
You can start with the simplest example, which would be a sequence of values $y$ converging to $x$ in some controlled manner (e.g. $\{1,1/2,1/3,1/4,1/5,\ldots\}$ with $x=0$) and figure out why this is not compact. You might find this hard the first time you try it - if you've never seen an example of non-compactness, you might need to be creative to figure out which open cover lacks a finite subcover. But, this is certainly a more manageable question than you started with - "show this set isn't compact" is way easier than "show all compact sets are closed."
Hopefully, you'll eventually see why this set isn't compact. If your counterexample to compactness isn't already written in terms of the balls $B(x,\varepsilon)$ that you initially started with, see if you can make it so that it does - you want this to generalize, and the only things you've really got so far is $x$, the balls around it, and, if we're thinking about counterexamples, some $y$. Okay, so maybe you don't see how to do that - maybe your brain is now stuck in "we got a sequence converging to something." Think of some other "counterexample" then - find some other set that's not closed and think about why it's not compact. Maybe you think about a disc minus a single point or a spiral closing in on your given point. Try to see non-compactness solely with regards to some balls around a point.
After enough experimentation, one would hope that you'll come up with the thought that every point in $K$ is some positive distance from $x$ - so is outside of $B(x,\varepsilon)$ for some $\varepsilon$. Then you're at least thinking about the sets $\mathbb R^n\setminus B(x,\varepsilon)$ - and, since you still have the overall goal of finding some open cover of $K$ to talk about, it should occur to you that these complements are closed - but maybe you can just modify them to be open and consider $\{y\in K: d(x,y) > \varepsilon\}$ or equivalently $\mathbb R^n\setminus \bar B(x,\varepsilon)$. You don't need to see the end yet, but, hey, you got an open cover of a set that seems to have something to do with the your overall goal - that's progress. Might as well see what using compactness yields.
Then, again, you hit some place where your mind could just leap to the answer, but if it doesn't, you can go back to the concrete examples you were thinking about and maybe modify them to take out some ball around $x$ from $K$ so that they become examples instead of counterexamples. What would compactness give then? How would we find the ball around $x$ we require just given that finite subcover? Hopefully, you'll stumble on the idea that, since the sets in your cover get larger and larger as $\varepsilon$ decreases, a finite subcover is going to have one element that contains all the others - so you would have just proven that $d(x,y) > \varepsilon$ for all $y$ and some fixed $\varepsilon$. Okay, now you're done. Go back and figure out the path you took, and write it down as a proof - and it's worth taking the time to write the proof down clearly (which is a whole can of worms by itself - but let's not get into proof writing).
Of course, you could be done then, but maybe you want to look for other proofs of the same fact, or maybe you want to find the most efficient way to develop real analysis. Maybe you come back some later day where you're more familiar with the topic as a whole and look at your proof to see if it has any commonalities with other proofs that might be pulled out as lemmas. You might recognize that the quantity $d(x,y)$ is appearing a lot - and hopefully, at some point before you stop studying the subject, you'll see that $f(y)=d(x,y)$ is a continuous function of $y$ - and really, your proof is just trying to show a positive lower bound for $f$ on $K$. You might too realize that your sets are just of the form $\{y\in K : f(y) > \varepsilon\}$, which might be reminiscent of the extreme value theorem's proof - and, oh hey, if we applied the extreme value theorem to this $f$ - which we know to always be positive - what do we get? Oh look - you just discovered that your proof of the original theorem was really just a little lemma on continuity of the distance function smashed together with the proof of the extreme value theorem - and, hey, now you have a name to give to all that fiddly business with open sets and balls, which should help you see the bigger picture even better than you would already have. Cool.
There's a ton of little intuitions and skills that I list above - I'm asking you to expand definitions and theorems without any trouble, to look at the contrapositives and negations of theorems you're interested in (and of the statements that arise in a proof), to keep clear both overarching goals of a proof and more minute ones, to instantiate broad statements down into specific examples, and, generally, to be perseverant in your work. These are skills you only really gain when you sit down with something hard and push yourself to produce something. Even when the path to your ultimate goal isn't clear, you are rarely ever truly without anything to do - if you are stuck, you should find something that you can do and which looks relevant and work on it - the worst case scenario is that you either find something simpler that you also don't understand (which is great - work on figuring that out first!) or you end up somewhere weird (which can also be great - there's lots of interesting mathematics that textbooks don't mention, but that you might run into exploring on your own). You'll get better at all the little skills doing this, and sometimes, you'll even make it all the way past the obstacles and come up with big proofs on your own - which is the surest way to understand a proof.
In short: it sounds like your goal is to go from knowing proofs to feeling able to produce proofs. The way to do that is to practice producing proofs.