The ego ideal, or the superego, as it is more popularly known, is the central cause of neurosis in psychoanalytic theory. “It is precisely in neurotics” Freud writes, “that we find the highest differences of potential between the development of their ego ideal and the amount of sublimation of their primitive libidinal instincts... the formation of an ideal heightens the demands of the ego and is the most powerful factor favouring repression“(On Narcissism, p.95). The ego ideal is born of ‘primary narcissism’ which is a state in which the child “was his own ideal (On Narcissism, p.94). This primary narcissism offers satisfaction to the child without the child having to do anything to deserve happiness. Primary narcissism is exchanged for an ego ideal and it is by living up to the ego ideal that the ego gets to recover some of this happiness. Freud writes:
Let us reflect that the ego now enters into the relation of an object to the ego ideal which has been developed out of it, and that all the interplay between an external object and the ego as a whole, with which our study of the neuroses has made us acquainted, may possibly be repeated upon this new scene of action within the ego... Each of the mental differentiations that we have become acquainted with represents a fresh aggravation of the difficulties of mental functioning, increases its instability, and may become the starting-point for its breakdown, that is, for the onset of a disease… But the ego ideal comprises the sum of all the limitations in which the ego has to acquiesce, and for that reason the abrogation of the ideal would necessarily be a magnificent festival for the ego, which might then once again feel satisfied with itself… There is always a feeling of triumph when something in the ego coincides with the ego ideal. And the sense of guilt (as well as the sense of inferiority) can also be understood as an expression of tension between the ego and the ego ideal (Group Psychology, 130-1, emphasis mine).
Different individuals will have different ideals that they have acquiesced to and in this sense their happiness will be different. This means that the type of ego ideal will be of central importance for different character types. In a passage from Civilization and Its Discontents Freud gives an example of three different types:
Happiness, in the reduced sense in which we recognize it as possible, is a problem of the economics of the individual's libido. There is no golden rule which applies to everyone: every man must find out for himself in what particular fashion he can be saved. All kinds of different factors will operate to direct his choice. It is a question of how much real satisfaction he can expect to get from the external world, how far he is led to make himself independent of it, and, finally, how much strength he feels he has for altering the world to suit his wishes. In this, his psychical constitution will play a decisive part, irrespectively of the external circumstances. The man who is predominantly erotic will give first preference to his emotional relationships to other people; the narcissistic man, who inclines to be self-sufficient, will seek his main satisfactions in his internal mental processes; the man of action will never give up the external world on which he can try out his strength. As regards the second of these types, the nature of his talents and the amount of instinctual sublimation open to him will decide where he shall locate his interests. Any choice that is pushed to an extreme will be penalized by exposing the individual to the dangers which arise if a technique of living that has been chosen as an exclusive one should prove inadequate. Just as a cautious business-man avoids tying up all his capital in one concern, so, perhaps, worldly wisdom will advise us not to look for the whole of our satisfaction from a single aspiration. Its success is never certain, for that depends on the convergence of many factors, perhaps on none more than on the capacity of the psychical constitution to adapt its function to the environment and then to exploit that environment for a yield of pleasure. A person who is born with a specially unfavourable instinctual constitution, and who has not properly undergone the transformation and rearrangement of his libidinal components which is indispensable for later achievements, will find it hard to obtain happiness from his external situation, especially if he is faced with tasks of some difficulty. As a last technique of living, which will at least bring him substitutive satisfactions, he is offered that of a flight into neurotic illness—a flight which he usually accomplishes when he is still young. The man who sees his pursuit of happiness come to nothing in later years can still find consolation in the yield of pleasure of chronic intoxication; or he can embark on the desperate attempt at rebellion seen in a psychosis. (Civilization, p.83-4)
By establishing different types of people with different types of ideals in life it is possible to understand Freud’s very general use of eros. One person may have eros in relation to finding love, another may find it in working towards glory or success, another may have an ideal to be the most beautiful/have the best taste, (etc.). In drawing attention to the ‘flight’ from the difficulties involved in having a high ego ideal Freud holds a position similar to Alfred Adler who similarly claims that all neurosis is from a lack of courage. From the flight from one’s ideals to the feelings of guilt, inferiority, self-pity (etc.). I take the liberty of using ego ideal to refer to the striving itself. I'll use phobos or fear to refer to both to the feeling of being unable to reach one's ideals and the next step of trying to give up one's ideal or attacking the internalized parental image upon which it is based. I’ll use the superego to refer to the punitive or judging aspect once the parental imago is abandoned. In this sense the superego would be synonymous with the death drive that is directed at the individual in relation to self-attacks that aren't based upon "natural" prohibitions of conscience . Freud writes:
If we turn to melancholia first, we find that the excessively strong super-ego which has obtained a hold upon consciousness rages against the ego with merciless violence, as if it had taken possession of the whole of the sadism available in the person concerned. Following our view of sadism, we should say that the destructive component had entrenched itself in the super-ego and turned against the ego. What is now holding sway in the super-ego is, as it were, a pure culture of the death instinct, and in fact it often enough succeeds in driving the ego into death…(Freud, The Ego and the Id, p. 53, emphasis mine).
The melancholic who was jilted by her lover wishes to attack the lover and the parental image upon which the ideal is based. However, she isn't free to give up the ideal without losing a constitutive part of her psyche and she must introject the parental imago and attack herself as she'd like to attack it.
In summary: We have a state of primary narcissism in which the child is simply his own ideal without being called to do anything to experience self-esteem. Then this primary narcissism is exchanged for an ego ideal. There are several ego ideals that correspond to different goals that limit the narcissism experienced by an individual. When the ego fears that it won’t be able to fulfill an ego ideal it experiences inferiority, guilt, etc. depending on the ideal. When the individual out of aggression and/or fear tries to give up on striving for the ideal then the aggression or libido powering the ego ideal defuses and attacks the individual as in melancholia or in paranoia.
This gives us the dialectic of
Eros (ego ideal) to Phobos (fear)
An individual may try dealing with phobos and not living up to an ideal by enacting ego defenses. Instead of feeling inferiority one can identify with the parental imago. For example one can behave like the internalized object of the father at the phallic-oedipal stage by being arrogant or superior to others. Additionally, aggression towards self in inferiority can be directed outward towards a racist object in which the Oedipal father is represented as a group that seeks obscene pleasures and is trying to obtain them unfairly (obscene sexual pleasure in African Americans wanting to rape white women or Jews controlling everything by cleverly taking advantage of others, etc.). However, this ego ideal model only explains drive theory through the anal, urethral, phallic, phallic-oedipal, and oedipal stages in which there is an ego that can form an ego ideal. Previous to this we’d have something which should be called an id ideal and related not to secondary narcissism but primary narcissism. Here such ideals would be based upon basic things like feeling safe in the world and the superego would be related to feeling like the world will end or that one doesn't deserved to exist. In the Economic Problem of Masochism Freud draws attention to this pre-self-representation form of the superego.
“Erotogenic masochism accompanies the libido through all its developmental phases and derives from them its changing psychical coatings. The fear of being eaten up by the totem animal (the father) originates from the primitive oral organization; the wish to be beaten by the father comes from the sadistic-anal phase which follows it; castration, although it is later disavowed, enters into the content of masochistic phantasies as a precipitate of the phallic stage or organization; and from the final genital organization there arise, of course, the situations of being copulated with and of giving birth, which are characteristic of femaleness…” (164-5)
Melanie Klein takes her investigations up from this point but still retains the ego and superego language even though the ego, again, as self-representation and secondary narcissism, still hasn’t formed.
It seems to me that people with early- schizoid (birth, ocular, oral, mimetic stage, primal scene) trauma who form id ideals are people who are more prone to having their basic transferences of safety and connection to the world shattered. However, even a person who didn’t have to form id ideals from inherited dispositions or bad mothering still make the same transference out into the world and if they experience rape, war, or some other severe event they too can have their destructive drive defuse from their ideal and experience psychotic processes.
 Lacan echos this and talks of the superego as an “obscene, ferocious Figure” and "a senseless, destructive, purely oppressive, almost always anti-legal morality" (Lacan, Ecrits: A Selection, p.256; Seminar I, p. 102).
 To understand this process Fairbairn spells out the logic in his statement “it is better to be a sinner in a world ruled by God than to live in a world ruled by the Devil” (Fairbairn, Psychoanalytic Studies of the Personality, p. 66-7). Since the transference to the father is an ego transference involving the functioning of the symbolic aspect of reality, the frustrations induced by the father–substitute would make part of reality seem hostile towards one. The melancholic, takes on the blame (perverts inner reality) and then attacks herself in order to save her outer reality. Paranoia is a parallel maneuver that sacrifices outside reality through projection as inside reality is sacrificed with the melancholic. Katan, among others, has noted the structural similarity of paranoia and melancholia: “We observe that the pictures of paranoia and melancholia correspond with each other in many respects. In both, the ego is the scene of action. In both, various layers of the same content are overlapping… (Katan, A Psychoanalytic Approach to the Diagnosis of Paranoia, p. 339-40). This has caused me to reassess Melanie Klein’s persecutory anxiety and depressive anxiety to not be related to developmental stages but rather to see them as positions in the sense of mental bisexuality (active-masculine and passive-feminine).
 The anti-Semite's profound satisfaction flows from the fact that his ego is in perfect harmony with his ego-ideal. Having made his projection onto the Jew, he has found his Manichaean paradise: all that is bad is thereafter on one side—the side of the Jew—and all that is good on the other side where he himself is. The photo carries the proof. The ego-ideal is narcissistic, and the satisfaction is that of perfect narcissistic integrity recovered through the projection on to the Jew (Grunberger, The anti-semite and the Oedipus Complex, p. 382).
 At the same time forming id ideals is what gives a painter, for example, his sense for form and colour, or gives another type of schizoid his sense of being at home with mathematics. The Id ideal can result in many potential gifts just as the later ego ideals can result in the drive to have the fame or recognition that can be a good thing too. See Fairbairn on schizoid individuals and their disposition to cultural achievements in Psychoanalytic Studies of the Personality
When the connotation of the term ‘schizoid’ is extended through an enlargement of our conception of schizoid phenomena in the manner indicated, the denotation of the term inevitably undergoes a corresponding extension; and the resulting schizoid group is then seen to become a very comprehensive one. It is found, for example, to include a high percentage of fanatics, agitators, criminals, revolutionaries, and other disruptive elements in every community. Schizoid characteristics, usually in a less pronounced form, are also common among members of the intelligentsia. Thus the disdain of the highbrow for the bourgeoisie and the scorn of the esoteric artist for the philistine may be regarded as minor manifestations of a schizoid nature. It is further to be noted that intellectual pursuits as such, whether literary, artistic, scientific, or otherwise, appear to exercise a special attraction for individuals possessing schizoid characteristics to one degree or another. Where scientific pursuits are concerned, the attraction would appear to depend upon the schizoid individual's attitude of detachment no less than upon his overvaluation of the thought-processes; for these are both characteristics which readily lend themselves to capitalization within the field of science. The obsessional appeal of science, based as this is upon the presence of a compulsive need for orderly arrangement and meticulous accuracy, has, of course, long been recognized; but the schizoid appeal is no less definite and demands at least equal recognition. Finally the statement may be hazarded that a number of outstanding historical figures lend themselves to the interpretation that they were either schizoid personalities or schizoid characters; and indeed it would appear as if it were often such who leave a mark upon the page of history. (p.6)
An updated version of this is here