First suppose that the $x_i$ are restricted to non-negative integers. In this case we need the $x_i$ to be
all equal, or at least as close to equal as possible.
The reason is that
For any $d>0$ we have
$$(t-d)(t+d) = t^2-d^2 < t\cdot t$$
and
$$(t-d)(t+d+1) = t^2+t-d^2-d < t(t+1)$$
So if any two of the $x_i$ differ by 2 or more, increasing the smaller and decreasing the larger will increase their product.
So the values of $x_i$ are:
$\lfloor \frac{k}{n}\rfloor$ or $\lceil \frac{k}{n}\rceil$. There will be $k \bmod n$ of the latter.
Suppose now that the $x_i$ are allowed to be negative.
For $n=1$ or $n=2$ allowing negative values makes no difference, so this case is as above.
For $n\ge 3$ we can choose the following values for $x_i$:
The first three variables have values $x_1=T+k+4-n$, $x_2=-T$, $x_3=-1$, and the remaining $n-3$ variables all have value $1$. Here $T$ is an arbitrary value large enough to make $x_1$ positive. Their sum is $k$ as required, but their product can be made arbitrarily large by choosing $T$ larger.