Some toddlers do hit themselves on the head as they soothe themselves to sleep. You can read more about it in this post to learn when to worry about the action.