Repairing top of damaged door trim
That is not the "door frame" but rather door trim and specifically it is crown molding. It will be nailed or screwed. Get up on a ladder and examine it from the top. Take pictures of what you see.

You will probably have to remove this element of the trim and reinstall it, but don't be in a hurry to tackle this. You could cause a lot of damage if you don't do it properly. Do it properly and you may not even have much (or any) touch up painting. Do it wrong, and you will make a mess that will require a professional to restore and will cost a pretty penny.

Honestly, a competent trim carpenter should be brought in to fix this. It appears another element has been pulled from the wall, and there is a trim piece missing, or paint missing, from the end of the horizontal trim above the door. It looks like the door trim was not complete. Is this a new house?