Can I combine different races as a single army?
It is perfectly legal to use Necrons with Chaos Space maines so long as you obey all the necessary allies rules.

In standard games of 40K your can field allies with your army using the Allies Matrix.  When you do this your select one army to be your primary detachment and the other one as the allied detachment.  Your primary detachment works as normal and you select your warlord from it as usual.  For the allied detachment you use a modified force organization chart:

[1] HQ
[0-1] Elites
[1-2] Troops
[0-1] Fast Attack
[0-1] Heavy Support


Allied detachments work with your army with varying amounts of efficiency.  You can see the full allies matrix below.

From the matrix you can see that Necrons and Chaos Marines are classified as Allies of Convienence. In this instance, it means that troop units from both detachments are scoring, but characters cannot join units from the other detachments.  Also, army abilities will treat the units from the other detachments as enemy models