Following this answer,
if we define a couple of rules for formal differentiation.
Clear[d];
d[Log[x_], a[k_]] := 1/x d[x, a[k]]
d[Sum[x_, y__], a[k_]] := Sum[d[x, a[k]], y]
d[a[k_] b_., a[k_]] := b /; FreeQ[b, a]
d[a[q_] b_., a[k_]] := b Subscript[δ, k, q] /; FreeQ[b, a]
d[c_ b_, a[k_]] := d[c, a[k]] b + d[b, a[k]] c
d[b_ + c_, a[k_]] := d[c, a[k]] + d[b, a[k]]
d[Subscript[δ, r_, q_], a[k_]] := 0
d[x_, a[k_]] := 0 /; FreeQ[x, a]
d[G_^n_, a[k_]] := n G^(n - 1) d[G, a[k]] /; ! FreeQ[G, a]
d[Exp[G_], a[q_]] := Exp[G] d[G, a[q]] /; ! FreeQ[G, a]
and some simplification rules
ds = {Sum[a_ + b_, {s_, 1, p_}] :>
Sum[a, {s, 1, p}] + Sum[b, {s, 1, p}],
Sum[y_ Subscript[δ, r_, s_], {s_, 1, p_}] :> (y /. s -> r),
Sum[y_ Subscript[δ, s_, r_], {s_, 1, p_}] :> (y /. s -> r),
Sum[Subscript[δ, s_, r_], {r_, 1, p_}] :> 1,
Sum[δ[i_, k_] δ[j_, k_] y_., {k_, n_}] -> δ[i,
j] (y /. k -> i),
Sum[a_ b_, {r_, 1, p_}] :> a Sum[b, {r, 1, p}] /; NumberQ[a]};
Clear[a]; Format[a[k_]] = Subscript[a, k]
Then considering
Q = Exp[a[i]]/Sum[Exp[a[j]], {j, 1, n}]; Q /. a -> x

we have for instance
grad = d[Q, a[p]] //. ds /. a -> x // Simplify

It is fairly general (though not fully bullet proof): for instance
Q = Exp[2 a[i] a[k]]/Sum[Exp[a[j]], {j, 1, n}]^4; Q /. a -> x

grad = d[Q, a[p]] //. ds; grad /. a -> x // Simplify

hess = d[grad, a[q]] //. ds /. a -> x // FullSimplify

1<i<n? – IPoiler Sep 06 '15 at 05:13Subscript[x,i]. – IPoiler Sep 06 '15 at 05:181<=i<=n. Is there some way I need to communicate that information to theDfunction? – RandomBits Sep 06 '15 at 12:07