Shouldn't tan(π/2) = ∞? We will first prove that $\sin(x)/\cos(x) = \tan(x)$.
By definition, $\sin(x) = O/H$, $\cos(x) = A/H$ and $\tan(x) = O/A$, where $O$,$A$ and $H$ are the opposite, adjacent and hypotenuse of a right angled triangle.
$\sin(x)/\cos(x) = O/H ÷ A/H = O/H × H/A = OH/AH = O/A = \tan(x)$
So $\tan(π/2) = \sin(π/2)/\cos(π/2) = 1/0$, which is undefined. However, we know that it can either be $∞$ or $-∞$. Therefore, $\tan(π/2)$ is equal to $∞$ or $-∞$.
If $\tan(π/2) = -∞$, then the limit of $\arctan(x)$ as $x$ approaches $-∞$ should equal $π/2$. However, it equals $-π/2$ instead. Therefore, $\tan(π/2)$ cannot be $-∞$, so it must be $∞$.
Is there any mistake in my working?

There are other great answers, yet I will like to present my explanation, which I believe adds to the post.
First of all, what is $\tan$? Well, certainly, it can be defined in terms of right triangles or circles, but to be "standard" let's use the definition:
$$\tan:\,\mathbb{R}\mapsto\mathbb{R}; \tan x:=\dfrac{\sin x}{\cos x}$$
(Note that I used the domain and codomain to be $\mathbb{R}$, presuming that's what you should be using.)
Now, clearly the fraction on the right is a real number when the denominator is not zero i.e. $\cos x\neq 0$ is the restriction for our function. What you did is didn't notice that and put $\cos x=0$. A zero in the denominator should be a red flag in the first place that things aren't right. So, the actual domain should be $\mathbb{R}\setminus\{x:\cos x=0\}$. (This simply means all values from $\mathbb{R}$ except those at which $\cos$ becomes zero.)
Coming to your second point, this is a common misconception that students have, namely they say that $1/0=\infty$ (or put a $\pm$, doesn't change the point). Remember it, division by zero is not allowed. (There are certain aspects of this, which you should not care about as of now.) So, basically
$$\dfrac10\color{red}{\neq}\infty$$
And definitions matter in math. You are not allowed to put that $\pi/2$ in place of the $x$ in $\tan x$, because it's defined that way!
As I said in the comments,
$$f(a)=\lim_{x\to a}f(x)$$
is not true for any $f$ and $a$; it's in fact the definition of continuity (in limit terms), the above condition defines that $f$ is continuous at $x=a$. Here, $\tan x$ is not continuous at $x=\pi/2$. If you've learnt about it, you can notice the type of discontinuity.
Hope this helps. Ask anything if not clear :)
