Q:

Second order ODE integration using scipy

I am trying to integrate a second order differential equation using 'scipy.integrate.odeint'.  My eqution is as follows
m*x[i]''+x[i]'= K/N*sum(j=0 to N)of sin(x[j]-x[i])

which I have converted into two first order ODEs as followed.  In the below code, yinit is array of the initial values x(0) and x'(0).  My question is what should be the values of x(0) and x'(0) ? 
x'[i]=y[i]
y'[i]=(-y[i]+K/N*sum(j=0 to N)of sin(x[j]-x[i]))/m

from numpy import *
from scipy.integrate import odeint

N = 50 

def f(theta, t):
    global N
    x, y = theta
    m = 0.95
    K = 1.0
    fx = zeros(N, float)
    for i in range(N):  
        s = 0.0 
        for j in range(i+1,N):  
            s = s + sin(x[j] - x[i])  
        fx[i] = (-y[i] + (K*s)/N)/m  
    return array([y, fx])  

t = linspace(0, 10, 100, endpoint=False)

Uniformly generating random number
theta = random.uniform(-180, 180, N)  

Integrating function f using odeint
yinit = array([x(0), x'(0)])
y = odeint(f, yinit, t)[:,0]
print (y)

A:

You can choose as initial condition whatever you want. 
In your case, you decided to use a random initial condition for x for all the oscillators.  You can use a random initial condition for 'y' as well I guess, as I did below. 
There were a few errors in the above code, mostly on how to unpack x,y from theta and how to repack them at the end (see concatenate below in the corrected code).  See also the concatenate for yinit. 
The rest are stylish/minor changes. 
from numpy import concatenate, linspace, random, mod, zeros, sin
from scipy.integrate import odeint

Nosc = 20
assert mod(Nosc, 2) == 0

def f(theta, _):
    N = theta.size / 2
    x, y = theta[:N], theta[N:]
    m = 0.95
    K = 1.0
    fx = zeros(N, float)
    for i in range(N):
        s = 0.0
        for j in range(i + 1, N):
            s = s + sin(x[j] - x[i])
        fx[i] = (-y[i] + (K * s) / N) / m
    return concatenate(([y, fx]))

t = linspace(0, 10, 50, endpoint=False)

theta = random.uniform(-180, 180, Nosc)
theta2 = random.uniform(-180, 180, Nosc) #added initial condition for the velocities of the oscillators

yinit = concatenate((theta, theta2))

res = odeint(f, yinit, t)
X = res[:, :Nosc].T
Y = res[:, Nosc:].T

To plot the time evolution of the system, you can use something like
import matplotlib.pylab as plt

fig, ax = plt.subplots()
for displacement in X:
    ax.plot(t, displacement)
ax.set_xlabel('t')
ax.set_ylabel('x')
fig.show()

What are you modelling?  At first the eq.  looked a bit like kuramoto oscillators, but then I noticed you also have a x[i]'' term. 
Notice how in your model, as you do not have a spring term in the equation, like a term x(t) at the LHS, the value of x converges to an arbitrary value:

