X-ray binaries are made up of two stars that orbit each other (like the Earth and the Moon). One of the stars is a "normal" star, like our Sun and the other is a neutron star or a black hole. These objects are so compact they have a huge gravitational force. Because of that, the compact star rips material from its companion star. This matter falls towards the compact star and is heated up to millions of degrees, so that it emits strongly in the X-ray domain.
The majority of stars in our Universe are in binary or multiple systems, that orbit about their common centre of mass. When one of the stars dies and if it is sufficiently massive, it can undergo a supernova explosion. The outer gaseous layers are ejected into Space, leaving only the dense core. These cores can continue to collapse until they become extremely dense, forming a neutron star or a black hole. Neutron stars have a mass similar to the Sun or as much as twice the mass of the Sun, but the matter is compressed into a sphere of only 10 km in radius. Black holes are even more compact – in fact they are the densest objects in the Universe. Their gravitational field is so extreme, that even light cannot escape the black hole, hence they are not visible.
The gravitational force of the black hole or the neutron star is so strong that it sucks material from the companion star. The material spirals towards the compact object and forms an 'accretion disc'. Sometimes we observe jets of material from the accretion disc. These jets travel rapidly, at almost the speed of light (the fastest speed possible).