It may capillaries broken , or may be a throat problem. The possibility of small lung and tracheal problems. In addition, such as dry weather at home has heating, may also be caused nose bleeding capillaries.
It could be any of many conditions. The most important thing is exactly where the blood is coming from. Is it in your saliva or are you coughing it up? If its the first one than the most common is that you accidently bit your lip or cheak, or that or that you have an ulcer in your mouth. Both of these problems should go away eventually with no treatment needed. If its the second one than the most common causes are either bronchitis, laryngitis, respiratory disease, or some other infection in the respiratory system.
Maybe because your mouth is hurt by your teeth when sleeping.
Blood in the saliva can be due to throat infection. Another possibility is gum bleeding. Anyhow, physical examination by the doctor is necessary to get proper diagnosis and treatment.