In fighter jets, how do pilots align the HUD with their eyeballs?
A pilot will usually adjust his seat height to align his eyes roughly with the design eye-position in an aircraft. As there is almost no parallax error, even with the wrong seat height, HUD-elements will still align correctly with objects outside, however, some HUD-elements will be outside the projected field-of-view and not be visible to the pilot.
The HUD is an outgrowth of the reflector or optical gunsight developed at the end of WWI and which started to appear on most fighters by the mid 30s. The secret to them is the collimator, or collimating lens, which is the big magnifying glass looking thing on a reflector sight.
A collimator aligns the light rays of an object to be parallel after they pass through the lens. The light rays being parallel, if you look at an object through the lens, it will be focused at infinity (it will look like it's a few hundred feet in front) even though it's only inches away. If you shine a light through a plate with a circular slot and hole in the middle, project the light off a mirror straight up, through the collimator, then reflect it back using a sloping sheet of glass (or the windshield), and you the pilot get in line with the projected light's rays, you will see an illuminated circle and dot (called a reticle) that looks like it's suspended in space several hundred feet in front.
You can only see the reticle if you are where the light rays are being projected, and there is almost no parallax error, so as long as you have the reticle in view, you are correctly lined up with a target up front. If you move your head to the side or up or down, the image will start to disappear off the side; but there is a fair amount of leeway, and your eye alignment doesn't have to be perfect, just enough to keep the reticle in view. This was so much easier than keeping your eye perfectly aligned with a ring and bead sight.
The effect is similar to looking at something projected on a movie screen at a drive in, while your car windshield is painted black except for a little square you can look through. If your head's in the right spot, you can see the image on the screen out front, focused way out there, but if you move your head the image starts to disappear.
In the 60s instead of just projecting light through a plate with slots and cross hairs etc., they started to use CRTs and project more information, like radar indications, horizon indications and such. By the 70s they where sophisticated enough to produce all the symbology you see on modern HUDS.
But in the end, a HUD is just super fancy version a WW2 gunsight.
When an airframer (whoever it happens to be) produces the requirements for a HUD, the following key optical items are specified.
1 The Eye motion box. This is a 3 dimensional zone and the critical items are the size of the box and the distance and angle from the HUD. This means that the pilot can move his head (not much in a fighter, clearly).
As noted in other answers, objects will come in and out of view as the viewing position is adjusted. That means there is an instantaneous field of view (the angles for which items can be seen from any point in the eye motion box) and a total field of view (which is everything that can be seen when viewed from all positions in the eye motion box).
2 The Cyclops eye position. This is the centre of vision of the pilot when viewing from the optical centre of the eye motion box.
There are many more parameters that I won't go into here as we are looking at where the pilot must be to properly view the HUD (although brightness range of the display can be very challenging as it might be in sunlight or in a moon-less night)
This leads to some interesting issues:
As fighters (and some other aircraft with HUDs such as the B2) are fitted with ejection seats, it requires the ejection seat manufacturer to specify the nominal height of the pilots eyes and the height adjustment range. Whether the position is specified by the ejection seat manufacturer or the airframer depends on whether the aircraft is new. (Oue newest, the F-35 does not have a HUD).
This is also one reason there are fewer female pilots in HUD equipped aircraft; their average height is less than that of males and most aircraft with HUDs today were designed around male height statistics.
A very expensive operation on a new aircraft is boresighting (aligning) the HUD and more specifically the mounting tray. This involves ensuring that where the view field of the HUD exists is precisely aligned in all 3 axes of the aircraft so that the display is indeed properly viewable from the eye motion box.
Because no mechanical alignment is ever perfect, the boresighting procedure actually generates a set of correction parameters that are used to adjust the location of items on the display; the method varies by HUD. This has to be performed on a per-aircraft basis.
Another interesting fact; as the surface of the HUD combiner is curved in some aircraft (F-22 and Typhoon comt to mind), any images must be pre-distorted so they appear not to be curved to the eyes of the pilot.
All this processing must be done with very low latency (16 millseconds is a common requirement) so modern HUDs have quite a bit of processing power within them.
HUDs are mechanized so that the "point" that the images appear appears to be several feet (I'm not exactly sure how far away it is, but it's at least several feet) in front of the pilot's eyes, far enough in front to eliminate the parallax effect that would cause inaccuracies as a result of the pilot's head being displaced left, right, up or down from an exact position. Indeed when you sit in the seat and look at the HUD as you move your head, the images appear to move in the combining glass as you are moving your head, so they remain on the same point in the distance.