It is unknown exactly when demons were created. Their purpose, however, was torturing the souls of the mortals that weren't worthy of Heaven, and some had the extra task of assisting Lucifer in his goals. Mazikeen is the only known demon to have continued to assist Lucifer after his departure from Hell.
After Lucifer's abdication, demons continued to serve their purposes, even without Lucifer to rule over them. It is implied by Amenadiel that it was him who restored order after Lucifer decided to abandon Hell, which further implies he was the ruler of the demons that reside in Hell. After his fall, it is unknown who controls the demons in Hell.