How to generate $k$ random numbers that add upto a number $d$ and are coprime with respect to $p-1$ This is something that is needed while generating additive shares ($D_i$) for decryption key (represented by $d$) where each additive share must be coprime with respect to $p-1$  i.e $\gcd(D_i , p-1) = 1$
My guess is that the actual requirement is: given


RSA modulus $n$ (odd and square-free)
$\lambda(n)$ per Carmichael's function
Note: $\lambda(n)=\dfrac{(p-1)(q-1)}{\gcd(p-1,q-1)}$ if $n$ is the product of distinct primes $p$, $q$
an RSA private exponent $d$, thus with $\gcd(d,\lambda(n))=1$
moderate $k&gt;1$


draw $k$ positive integers $d_i$ less than $\lambda(n)$ at random except they are such that


$\gcd(d_i,\lambda(n))=1$ for all $i$
$x^d\bmod n\ =\ \left(\displaystyle\prod_{i=0}^{k-1}x^{d_i}\bmod n\right)\bmod n$ holds for all $x$


The condition 1 is equivalent to $\gcd(d_i,p-1)=1$ of the question applied to all primes $p$ dividing $n$. It insures that $x\mapsto x^{d_i}\bmod n$ is a bijection of $[0,n)$, which possibly is desirable in the context of 2.

The question requires $d=\displaystyle\sum_{i=0}^{k-1}d_i$. That's not necessary for 2 to hold. We'll relax that requirement to $d\equiv\displaystyle\sum_{i=0}^{k-1}d_i\pmod{\lambda(n)}$, which is equivalent to 2, gives more choices for the $d_i$, makes the selection simpler.

Update: no matter what, we still must restrict to odd $k$: since $\lambda(n)$ is even, $d$ and all $d_i$ must be odd.

The limit $\lambda(n)$ for the $d_i$ is usual in modern expositions of RSA. It is pointless to choose a larger upper limit, for RSA exponents are equivalent modulo $\lambda(n)$.



Following closely the approach suggested in Daniel's comment, we can


for $i$ from $1$ to $k-1$


pick $r$ random in $[0,\lambda(n)/2-1]$ and set $d_i\gets2r+1$ until $\gcd(d_i,\lambda(n))=1$

compute $d_0=\left(d-\displaystyle\sum_{i=1}^{k-1}d_i\right)\bmod\lambda(n)$
if $\gcd(d_0,\lambda(n))\ne 1$


pick a random $i$ in $[1, k-1]$
pick $r$ random in $[0,\lambda(n)/2-1]$ and set $d_i\gets2r+1$ until $\gcd(d_i,\lambda(n))=1$
proceed at 2



Note: if we fixed $i=1$ in step 3, we'd end up with a slightly biased, but probably tolerable choice.



A comment states


  we need to find the inverse of $d_i\bmod p$


Perhaps that really means computing $e_i={d_i}^{-1}\bmod\lambda(n)$, which allows to verify $y_i=x^{d_i}\bmod n$ because for all $x$ in $[0,n)$ that's equivalent to $x={y_i}^{e_i}\bmod n$.

Beware however that we can't distribute public-key encryption in this way, for knowledge of $n$, $e_0$, $e_1$, $x^{e_0}\bmod n$ and $x^{e_1}\bmod n$ allows recovery of $x\bmod n$ when $\gcd(e_0,e_1)=1$, which is not unlikely.