Why is there no mention of the domain of a function in the first order logic? In defining the language, according to my logic book, if $f$ is n-ray function and $\alpha_1, \alpha_2, \cdots, \alpha_n$ are terms, then $f(\alpha_1, \alpha_2, \cdots, \alpha_n)$ is always a term. Why is there no mention of the domain of a function here? I think we need to think of domain as well as arity of function...  What can we do if we want to think about two functions with different domains in the first order language?
 A: The issue is simply that the first-order logic that is usually presented is single-sorted first order logic. In multi-sorted first-order logic, we have a collection of sorts and a function symbol can take an arbitrary (but fixed) list of sorts and produce an arbitrary sort, e.g. $f : (X,Y)\to Z$. In the single-sorted case, we have (unsurprisingly) only one sort and so we only get things like $f : (X,X)\to X$. At this point, the only information we need to specify the is the number of inputs, i.e. the arity. What's usually called the domain of the interpretation (not to be confused with the domain of a function) is the interpretation of this single sort. In multi-sorted first-order logics, you will have a domain per sort.
As Reveillark stated, there's a difference between a function symbol and a function. The scenario you describe in your last comment simply can't happen in single-sorted first-order logic. The interpretation of all function symbols (with the same arity) have the same domain. By definition, those functions must be defined on the entire domain of the interpretation. A structure that interprets the domain as $\mathbb R$ but interprets some unary function symbol as $\mathsf{sqrt}$ is simply not a valid interpretation.
Your options are 1) use a multi-sorted first-order logic, but this very likely won't do what you want, 2) talk about functional predicates that get interpreted as functional (but not necessarily total) relations which may work if all your domains are a subset of another domain but probably isn't want you want in general, or 3) talk about set-theoretic functions in a (presumably single-sorted) first-order logic but then interpretation doesn't come into it. (Or, use some other logic entirely.)
Most of your experience with functions comes from (nominally) set-theoretic functions. You can do many things to such set-theoretic functions because they are, after all, just sets (namely, sets of pairs satisfying some rules), so you can do anything you can do to sets to them. When you were asked to determine the domain of a function like $\frac{1}{1-x}$ before, you were really being asked to describe the set $\{x\mid \exists y.(x,y)\in f\}$. Within the syntax of a first-order logic, the only thing you can do with a function symbol is apply it to some terms. In more general approaches to semantics, i.e. categorical semantics, you don't even need to interpret function symbols as functions.
