X-ray diffraction is a technique used to analyze the crystal phases present in a sample. X-rays have a similar wavelength to the interatomic spacing of close-packed crystals, meaning the crystals can act as a diffraction grating. When the Bragg condition is satisfied, X-rays reflecting off of a given crystallographic plane constructively interfere, leading to significant spikes in intensity at a characteristic angles. Copper-K alpha radiation is commonly used for this technique. The long-range order found in polymeric materials can be studied with specialized small angle X-ray diffraction systems. To obtain ultra-high quality patterns, neutron diffraction should be used, but this requires a synchrotron source, and is typically performed at national labs.
The most common form of XRD is powder diffraction using the Bragg-Brantano geometry. A sample of randomly oriented crystals is placed on a glass slide, and a diffraction pattern is obtained across a range of angles (commonly 10-90 degrees). X-rays should penetrate into the top few microns of the sample, and any crystalline order in the sample should present as peaks in the intensity.
The necessary scanning time is highly dependent upon both the XRD system and the sample. As a rough estimate, a modern system and a highly crystalline sample should provide an adequate spectra at 5+ degrees per minute, and data quality will scale with the square root of scan time.
The location of these peaks can be used to determine the crystal structure. Patterns are often loaded into a pattern matching Software such as JADE. Background signal can be removed, and then the pattern can be compared to the crystallography database of known patterns. If the constituent elements of the sample are known, the search can be limited to compounds containing these elements. High quality patterns can be quantitatively analyzed via Rietfeld Refinement; an excellent introduction to this technique can be found here. https://subversion.xray.aps.anl.gov/pyGSAS/trunk/help/Tutorials.html.
Prominent XRD manufacturers include Rigaku and Bruker, and entry-level machines can cost on the order of 50,000 - 100,000 dollars.