Two notions of total derivative. Let $f:\mathbb R^n\rightarrow \mathbb R^m$ be a function. By definition, $f$ is differentiable at $a$ if there exists a linear map $D_af:\mathbb R^n\rightarrow\mathbb R^m$ such that
$$\lim_{h\rightarrow 0}\dfrac{||f(a+h)-f(a)-D_af(h)||}{||h||}=0$$.
When this limit exists, we call $D_af$ the total derivative of $f$ at $a$ and we call the corresponding matrix with respect to usual basis, the Jacobian matrix $J_af$. Now $f$ can be written as $f=(f_1,\cdots,f_m)$ where each $f_i:\mathbb R^n\rightarrow \mathbb R$ and $f(x)=(f_1(x),\cdots,f_m(x))$. 
We define the partial derivative of $f_i$ at $a=(a_1,\cdots,a_n)$ in the direction of $x_j$ by the real number (if it exists)
$$\dfrac{\partial f_i}{\partial x_j}(a)=\lim_{h\rightarrow 0}\dfrac{f_i(a_1,\cdots,a_j+h,\cdots,a_n)-f_i(a)}{h}$$
And we show that when $f$ is differentiable at $a$ then all the real numbers $\dfrac{\partial f_i}{\partial x_j}(a)$ exist and the matrix elements $(J_af)_{i,j}=\dfrac{\partial f_i}{\partial x_j}(a)$.
Now I see in wikipedia articles that they give the name total derivative also for some other notion: given a map $g:\mathbb R^n\rightarrow \mathbb R$ then the total derivative of $g$ with respect to $x_j$ is 
$$\dfrac{dg}{dx_j}=\dfrac{\partial g}{\partial x_1}\dfrac{dx_1}{dx_j}+\cdots+\dfrac{\partial g}{\partial x_n}\dfrac{dx_n}{dx_j}$$
My questions:
1) Is the formula above a definition for $\dfrac{dg}{dx_j}$ ? 
2) Is the notion of $\dfrac{dg}{dx_j}$ reserved only for real valued maps $g:\mathbb R^n\rightarrow \mathbb R$ since it has partial derivatives in its definition formula? 
3) How does these two notions of total derivative relate?
 A: The total derivative is only a piece of notation to overcome some difficulties when dealing with Leibniz notation.
Consider the function $f(x,y)=x^2+y$. If you agree that $x$ and $y$ in the definition of $f$ are just placeholders you should agree that $f(y,x)=y^2+x$ and that $f(t,t^2)=2t^2$.
Now the question is: what does $\partial f / \partial x$ means? Written like that one would interpret $\partial/\partial x$ as the derivative of $f$ with respect to the first variable. Notice here that the variable $x$ is no more a simple place-holder but has a conventional meaning. 
For example consider the following:
$$
\frac{\partial f(y,x)}{\partial x}.
$$
Now the interpretation is not clear... you mean the derivative with respect to the first or the second variable?
Mixing variables like that is not good... but sometimes one should be prepared to solve the ambiguity. Consider a function $f(x,t)$ which represent a quantity which depends on space $x$ and time $t$. So it is understood that $\partial f/\partial t$ is the derivative with respect to the second component (which is time). Suppose now that you have a particle which moves with the law $x=t^2$. If you evaluate the function $f$ on the particle you get
$$
  f(x(t),t)
$$ 
and if you want to compute the derivative of this function you can use the chain rule and obtain:
$$
\frac{d}{dt} f(x(t),t) = \frac{\partial}{\partial x} f(x(t),t)\cdot x'(t) + \frac{\partial }{\partial t} f(x(t),t).
$$
Now the point is that often it is useful to reduce the notation writing $x$ in place of $x(t)$ and $f$ in place of $f(x,t)$ so that previous formula could be written as
$$
  \frac{d}{dt} f(x,t) = \frac{\partial}{\partial x} f(x,t) \cdot x'(t) + \frac{\partial }{\partial t} f(x,t) 
$$
or 
$$
  \frac{df}{dt} = \frac{\partial f}{\partial x} \cdot x' + \frac{\partial f}{\partial t}. 
$$
Now you see that $d/dt$ and $\partial/\partial t$ assume different meanings...
A: What you call total derivative, I prefer to call it differential since it is more standard and leads to no confusion.
The notion of total differential is used when the variables on your space have interdepedencies. Let me give two examples:
Consider the function $f(x,y) = xy$ on $\mathbb{R}^2$. Its partial derivative w.r.t to $x$ is $y$. Its differential is $df = ydx + xdy$. Now, suppose that you look at your fonction, not on the whole space $\mathbb{R}^2$, but on some submanifold $M$. There are essentially two ways of describing this manifold (here a curve), either by an equation $g(x,y) = 0$ or by a parametrisation $\gamma(t) = (x(t),y(t))$.
In the first case, the equation gives an equation on the $1$-forms $dx$ and $dy$ on $M$, that is $\partial_x g(x,y) dx + \partial_y g(x,y) dy = 0$. You can also write it as $dy = -\frac{\partial_y g(x,y)}{\partial_x g(x,y)} dx$. So if you look at $f_{| M}$, its differential is given by $(y-x\frac{\partial_y g(x,y)}{\partial_x g(x,y)})dx$. And the quantity $y-x\frac{\partial_y g(x,y)}{\partial_x g(x,y)}$ is called the total derivative of $f$ w.r.t to $x$ on the submanifold $M$.
In the second case, we can consider $f$ as a function of $t$ and its partial derivative w.r.t to $t$ is simply given by the chain rule: $\partial_t f = y \partial_t x  + x \partial_t y$. In some sense, this can be considered as a total derivative. In general, we really call it a total derivative when your parametrisation itself is function of $x$, that is $\gamma(x) = (x, y(x))$ with some abuse of notation. Then the total derivative of $f$ w.r.t to $x$ is simply the partial derivative of $f \circ \gamma$ w.r.t to $x$, that is $\partial_x f + \partial_y f \partial_x y$.
Generally, one variable is the time, and the other variables are thought as function of the time (which amounts to look at your function in some curve parametrized by the time).
Remark that in order to speak of the total derivative w.r.t a variable, the submanifold has to be $1$-dimensional.
This should answer $1)$ and $3)$. If you have a function which is vector-valued, you can do the same with each component, so the notion is not only for real valued maps. This answers $2)$.
A: (1) Yes, you can interpret this as a definition for the notation $\frac{dg}{dx_j}$. As I explain in (3) below, this is just a special case of the first definition of total derivative that you give, so it's not actually defining a new concept; rather, we're just giving a new notation for a thing we already know about.
(2) I think this second notion of total derivative can be used in general for multivariable functions $g : \mathbb R^n \to \mathbb R^m$, but in practice I have only ever seen it used for functions with type $\mathbb R^n \to \mathbb R$ (i.e. where the output is a scalar).
(3) The two are very much related: the second notion is a special case of the first notion. To make this simpler to type, let's call the first notion of total derivative "total derivative(1)", and the second notion of total derivative "total derivative(2)".
Then the relationship between the two is this: total derivative(2) is the special case of total derivative(1) when the intermediate layer of variables ($x_1, \ldots, x_n$ in your example) are all functions of a single variable ($x_j$ in your example).
To make sense of this, here is an example: consider a function $w = f(x,y,t)$, where $x=g(t)$ and $y=h(t)$ are also functions of $t$. This fits the special case mentioned above: the intermediate layer variables ($x,y,t$) are all functions of a single variable ($t$). This must mean that the total derivative(1) of $w$ is the same as the total derivative(2) of $w$.
The total derivative(1) of $w$ can be computed using the multivariable chain rule. To explicitly show the composition, we can define a function $\phi(t) = (g(t), h(t), t)$ so that $w = f(\phi(t))$. By the multivariable chain rule, $$D_t w = D_t (f \circ \phi) = D_{\phi(t)} f \circ D_t\phi$$ What does this mean? In general (if we elide the distinction between a linear map and a matrix representing that map), the total derivative(1) is a matrix of partial derivatives. We know that $\phi$ is a function of a single variable $t$, so the total derivative(1) $D_t\phi$ is a vector of the derivatives of the component functions (a.k.a. 3 by 1 matrix of partial derivatives, which are just ordinary single-variable derivatives in this case), i.e. $D_t \phi = (\frac{dg}{dt}, \frac{dh}{dt}, \frac{dt}{dt}) = (g'(t), h'(t), 1)$. And we know $f$ is a function $\mathbb R^3 \to \mathbb R$, so the total derivative(1) is the gradient (a.k.a. 1 by 3 matrix of partial derivatives), i.e. $D_{\phi(t)} f = \nabla f(\phi(t)) = (\frac{\partial f}{\partial x}, \frac{\partial f}{\partial y}, \frac{\partial f}{\partial t})$. The composition $\circ$ on the right-hand side of the chain rule tells us to interpret this expression as a composition of linear maps, i.e. matrix multiplication. Our matrices are 1 by 3 and 3 by 1, so we can think of the matrix multiplication as a dot product: $$\begin{align}D_t w &= \begin{pmatrix}\frac{\partial f}{\partial x} & \frac{\partial f}{\partial y} & \frac{\partial f}{\partial t}\end{pmatrix} \begin{pmatrix}\frac{dg}{dt}\\ \frac{dh}{dt}\\ \frac{dt}{dt}\end{pmatrix} \\ &= \left(\frac{\partial f}{\partial x}, \frac{\partial f}{\partial y}, \frac{\partial f}{\partial t}\right) \cdot \left(\frac{dg}{dt}, \frac{dh}{dt}, \frac{dt}{dt}\right) \\ &= \frac{\partial f}{\partial x}\frac{dg}{dt} + \frac{\partial f}{\partial y}\frac{dh}{dt} + \frac{\partial f}{\partial t}\frac{dt}{dt}\end{align}$$
Now let's compute the total derivative(2) of $w$. We have $$\frac{dw}{dt} = \frac{\partial f}{\partial x}\frac{dx}{dt} + \frac{\partial f}{\partial y}\frac{dy}{dt} + \frac{\partial f}{\partial t}\frac{dt}{dt}$$ But $\frac{dx}{dt} = \frac{dg}{dt}$ since $x = g(t)$, and $\frac{dy}{dt} = \frac{dh}{dt}$ since $y = h(t)$. Thus the total derivative(1) and total derivative(2) are equal.
However, total derivative(2) only makes sense in the case where the intermediate layer variables are all a function of some single variable. If this is not the case, then expressions like $\frac{dx_1}{dx_j}$ don't make sense since $x_1$ and $x_j$ are allowed to vary independently (because we didn't assume any functional relationship between them). Total derivative(1) makes sense even in this case (if $g : \mathbb R^n \to \mathbb R$ then it's just the gradient).
