What exactly does second-order variable mean? I know that first order variable (usually denoted by lower case letters like $p,q,r...$) are those which take the value $T$(true) or $F$(false). I see that second-order variable are usually denoted by higher case letters (like $X,Y...$).
I at first thought that the second order was concerned with the arity of the relation, like unary relation(set) or binary relation(like the edge relation in Graphs). But then when I saw the definition of monadic second order logic, I was surprised to know that second order variable can be unary. I am too confused and would really appreciate some help in understanding what exactly a second order variable means?
Not exactly.
First-order variables, usually: $x,y,z,\ldots$ stand for "objects".
Second-order variables, usually: $X,Y,Z,\ldots$ stand for "properties" of objects, like relations.
Example: the (second-order) Axiom of induction :
In this case, $k,n$ are first-order variables, ranging over numbers: the objects of the domain, while $P$ is a second-order (and unary) variable, ranging over properties of numbers.
See Second-order and Higher-order Logic.
The order of a property (or predicate) is its "level" in the hierarchy of objects-properties of objects-properties of properties of objects, and so on.
It is not the arity of a predicate symbol.
The arity of a predicate or relation (in logic represented by predicate symbols) is the number of its argument places.
A unary predicate is e.g "even": $\text {even}(x)$.
A binary predicate is e.g. "less than" : $<(x,y)$, usually written (for readibility): $x < y$.
A ternary predicate is e.g "between" : $\text {between}(x,y,z)$, meaning: $y \text { lies between } x \text { and } z$
The unary predicate $\text {even}(x)$ defines also a set, the set of even numbers: $\{ n \mid \text {even}(n) \}$.
And the binary predicate $<$ defines a (binary) relation, i.e. a set of couples: $\{ (n,m) \mid n < m \}$