How to get intuition in topology concerning the definitions? Most topology texts go on directly to give definition of topology, then they give some examples and that's it, like they directly tell you right

Let $X$ be a set and let $τ$ be a family of subsets of $X$. Then $τ$ is called a topology on $X$ if:
  
  
*
  
*Both the empty set and $X$ are elements of $τ$
  
*Any union of elements of $τ$ is an element of $τ$
  
*Any intersection of finitely many elements of $τ$ is an element of $τ$
  

But why did we define it this way? What's the intuition? 
Does anyone know a good text on topology which gives the intution behind the concepts, ...etc ?
 A: Here are some general pointers for gaining intuition in topology:


*

*Learn lots of examples early, and use them to guide your understanding. Take the definition of a topology, for instance.  The original motivation for this definition comes from familiar topological spaces, such as the real numbers or, more generally, $\mathbb R^n$ or, more generally still, metric spaces.  Learn the definition of continuous maps $\mathbb R^m\to \mathbb R^n$ and between metric spaces in general and then try to understand why the 'open-set' definition of a continuous map is equivalent to these definitions.  At this point, it is natural to ask how far we can generalize this definition.  Topology is really about replacing '$\epsilon$-balls' in metric spaces with more general 'basic open neighbourhoods' that have precisely the right properties that let us make sense of concepts like 'continuous map' or 'small neighbourhood' that we're used to from real analysis.

*Learn how to draw pictures of topological spaces.  A seasoned topologist will naturally draw the diagram

for an open set $U$ contained in a topological space $X$ or

for the product space $X\times Y$, even if the spaces don't actually look like that at all.  Drawing a diagram will help you get intuition for writing actual proofs.  

*Recognize that sometimes you're just going to have to do a lot of topology.  The definition of a compact topological space is notoriously difficult for newcomers to the subject to internalize.  Looking back at my own mathematical development, I don't think that there's anything that anyone could have said to me at the time that would have helped me understand it better.  After a few years of using this definition, and working with compact spaces - primarily the closed interval $[0,1]$, I've got a much better understanding of its importance.  Indeed, my advice to anyone who wants to understand compactness is to learn a proof of the Heine-Borel theorem (i.e., $[0,1]$ is compact) and then go back and write new proofs of the following theorems from real analysis using only the fact that $[0,1]$ is a compact topological space:


*

*the Bolzano-Weierstrass theorem

*every continuous function $[0,1]\to\mathbb R$ is bounded

*the Lebesgue number lemma

*the closed graph theorem: a function $f\colon[0,1]\to\mathbb R$ is continuous if and only if its graph $$\Gamma_f=\{(x,f(x))\colon x\in\mathbb R\}\subset[0,1]\times\mathbb R$$
is a closed set.


*Keep asking (yourself) questions. You're doing exactly the right thing by questioning the definitions you're seeing.  If you blindly accept every definition you're taught without questioning whether it's natural or 'correct' then you'll find that you get to the end of a course in topology without really understanding anything you've been taught.  Every time you see a definition, ask yourself 'Why has it been defined this way?'  At the same time...

*Understand that there's no hurry. If you don't immediately get why a definition is used, don't worry about it and try and move on.  Topology has been gone over and refined many times in the hundred or so years it's been around and you can be sure that the definitions you are seeing are natural and very useful.  You can also be sure that, over the course of your studies in mathematics, you will come across topology again and again, and this will give you a chance to keep re-asking the questions you've been asking yourself.  Each time you'll get more and more answers.

*(optional) Learn equivalent definitions.  The reason this is optional is that plenty of people have survived perfectly well with the usual definitions from topology, and you certainly shouldn't spend your time learning lots of other definitions if you're having trouble with the existing ones.  However, it can be useful to learn some alternative ways of looking at things.  For example, here are some alternatives to the 'open set' definition of a topology:


*

*System of basic open neighbourhoods - This is pretty similar to the 'open set definition', but rather than requiring that our collection of sets be closed under unions and all finite intersections, we only require that the intersection of two basic open neighbourhoods can be written as the union of basic open neighbourhoods.  This definition is technically less precise than the usual definition, since different systems of b.o.n.s can give rise to the same topology, but it is sometimes more natural.  For example, the topology on a metric space is induced by the system of basic open neighbourhoods given by $\epsilon$-balls $B(x,\epsilon)$.  

*Closure operator It's interesting that the topology on a space $X$ can be deduced from the closure operator $\text{Cl}\colon\mathcal P(X)\to\mathcal P(X)$.  This gives rise to an equivalent definition of a topological space; see Wikipedia.
For compactness:


*

*Sequential compactness.  This only works for metric spaces, but is still fun.  A metric space is compact if and only if it is sequentially compact - every sequence has a convergent subsequence

*Categorical compactness.  A topological space $X$ is compact if and only if for every topological space $Y$ the projection map $\pi_Y\colon X\times Y\to Y$ is a closed map.  See this note.
A: Your question calls for a textbook. Until you find one, you might try to connect this definition to what you may know about continuous functions of a real variable. Suppose $\tau$ is the set of all unions of open intervals $(a,b)$. Try to write the "$\epsilon-\delta$" definition of continuity using elements of $\tau$ instead of intervals.
A: I would suggest first studying a good, advanced textbook on multivariable calculus, with a focus on the distance function in Euclidean space, the concept of open subsets of Euclidean space, and the multitude of $\epsilon-\delta$ proofs in multivariable calculus. 
Next, I would suggest finding a good textbook on metric spaces, again focussing on the concept of open subsets in relation to $\epsilon-\delta$ proofs. I quite like this book.
With that background, you should have developed a good intuition for open sets, preparing you for the abstract definitions of Topology.
A: Topology is about to supply a set $X$ with the simplest possible non trivial concept of vicinity, where a point in $X$ could be close to a subset of $X$ without eventually being a member of the set. Those points are the points in the closure  of a set. 
Topology can alternatively be defined by the closure function.
Set theory is about which points or elements that is members of a set. In topology a structure is added: beyond the question of which points that are members now the question of which points that are in the closure of the set can be answered.
Example: $1\notin (0,1)\subset\mathbb R$ but any open set including $1$ also includes some points of this open intervall $(0,1)$: $1$ is close to $(0,1)$, or better, $1$ is in the closure  of $(0,1)$. If $\mathcal O$ is an open set including $1$, then $\mathcal O \cap (0,1)\neq \emptyset$. The way the set $\mathbb R$ is defined, supplies $\mathbb R$ with it's well known topology (vincinity).
A: [This is just about basis of a topology.]
Recall the notion of open sets in ${ X }$ ${ = \mathbb{R} ^n }.$ We call ${ U \subseteq \mathbb{R} ^n }$ open if for every ${ p \in U }$ there is a "bulge" ${ B(p,r) }$ with ${ p \in B(p,r) }$ ${ \subseteq U }.$ An issue with generalising this to an arbitrary set ${ X }$ is the lack of any notion of "bulge". Turns out one can remedy this.

Let ${ X }$ be a set, and ${ \mathscr{F} }$ a collection of subsets of ${ X }.$
Def: Let ${ p \in X }.$ For brevity, an ${ \mathscr{F} - }$bulge of ${ p }$ is simply an element of ${ \mathscr{F} }$ containing ${ p }.$
Def: ${ \mathscr{F} }$ is a collection of proper bulges if :
i) Every ${ p \in X }$ has an ${ \mathscr{F} - }$ bulge.
ii) Say ${ A,B }$ are two ${ \mathscr{F} - }$ bulges of ${ p }.$ Then we can pick a smaller ${ \mathscr{F} -}$ bulge ${ C }$ with ${ p \in C }$ ${ \subseteq A \cap B }.$

Informally, i) says we can bulge every point, and ii) says given any two bulges of ${ p }$ we can pick a bulge of ${ p }$ "smaller than both" (in the sense "contained in both").

Now that we have a reasonable notion of bulging...

Let ${ X }$ be a set, and ${ \mathscr{F} }$ ${ \subseteq \mathscr{P}(X) }$ a collection of proper bulges.
Def: Subset ${ U \subseteq X }$ is open (in ${ \mathscr{F} }$ sense) if for every ${ p \in U }$ there is an ${ \mathscr{F} - }$bulge ${ B }$ with ${ p \in B }$ ${ \subseteq U }.$

That is, ${ U }$ is open if and only if it is some union of elements of ${ \mathscr{F} }.$

The collection of all such open sets is called a topology ${ \tau _{\mathscr{F} } }.$

Let ${ X }$ be a set.
We see any topology ${ \tau _{\mathscr{F}} }$ (where ${ \mathscr{F} }$ is a collection of proper bulges) is closed under arbitrary unions and finite intersections, and has ${ \emptyset, X }$ in it.
Conversely, if ${ S \subseteq \mathscr{P}(X) }$ is closed under arbitrary unions and finite intersections, and has ${ \emptyset, X }$ in it, then ${ S }$ is a topology (because ${ S }$ itself is a collection of proper bulges, and ${ S = \tau _{S} }$).
This gives the usual characterisation of a topology.
