Can anyone please help me to understand what does "well-defined" mean in the definition of Set? We know that

A set is a well-defined collection of distinct objects, considered as
an object in its own right.

Can anyone please help me to understand  what does well-defined mean?
Let's say $X = \{ 1 , 2 , 3 , \tan \frac{\pi}{2} \}$.
Is $X$ a set ? $\tan x$ tends to infinity when   $x \in (0 , \frac{\pi}{2})$    and $x$ tends to $\frac{\pi}{2}$. And $\tan x$ tends to minus infinity when   $x \in ( \frac{\pi}{2} , \pi )$    and $x$ tends to $\frac{\pi}{2}$. But we do not have any concrete idea about $\tan \frac{\pi}{2}$. So it is undefined. So $X$ can not be called a set. Am I correct ?
 A: "Well-defined" means that the definition indeed specifies one and only one object.
For example

*

*Let $n$ be the even prime.
This makes $n$ well-defined, because there is exactly one even prime, $2$.


*Let $n$ be the prime between $24$ and $28$.
This looks like a definition but is not well-defined. There is no prime between $24$ and $28$.


*Let $n$ be the prime below $10$.
Again, this is not well-defined, this time because there are several primes below $10$. Note that by saying “the” you claim uniqueness.


*Let $n$ be the smallest composite prime.
Again, not well-defined. There is no composite prime because the two notions “composite” and “prime” contradict each other.
A: 
Is $X$ a set? I think it is not because $\tan\frac{\pi}2$ is infinity.

Guessing your context, you are correct. I would technically say that, since $\frac\pi2$ is not in the domain of $\tan$, the object $\tan\frac\pi2$ is undefined.
(Unless, maybe if you have previously defined $\infty$ is as an object, and defined $\tan\frac\pi2$ to be
$$\tan\frac\pi2 := \lim_{x\to\frac\pi2}\tan x = \infty.$$
But you probably haven't done this.)
People say a set is "well-defined" to mean that there aren't any problems/contradictions/inconsistencies (like the above) when defining it.
A: The term "well-defined" is not being used to refer to the domain of definition of a partial function (like $\tan$) here, but rather to the fact that not every purported definition defines a set.
A famous example is Bertrand Russell's set of sets that do not contain themselves:
$$
R = \{ x \mid x \not\in x \}
$$
Then if $R \in R$, this implies that $R \not\in R$, while if $R \not\in R$, unfortunately $R \in R$. Either way we get a contradiction.
The way we use sets nowadays starts with certain sets (e.g. $\omega$, the set of natural numbers) as given and defines others as subsets, and does not allow us to define $R$, so we avoid this contradiction (we cannot prove that a contradiction is avoided, but that just a general feature of mathematical theories that can express enough arithmetical facts and for which the set of provable statements is computably enumerable, nothing to do with set theory in particular).
A: It is well to notice that what you quoted is not an actual definition of a set in axiomatic set theory where sets are undefined terms with certain axiomatic properties. It is similar to the original definitions of Cantor who founded set theory. For example, a quote from 1895

By a 'set' we understand every collection to a whole
$M$ of definite, well-differentiated objects $m$ of our
intuition or our thought. (We call these objects the
'elements' of $M$.)

This is similar to dictionary "definitions" of words
which use other word phrases in the definitions, but not
everything can be defined this way. There must be
first given a number of undefined words from which all
other words are defined. For example, what exactly is
a "collection"? The key concept turns out to be that of
elementhood. That is, it must be always possible to be
able to definitely decide if $m$ is an element of $M$
or is not, for any given $m$ and $M$.
