Q:

What exactly is trim?

Although I have a rough idea of what it is...
In my mind from growing up watching hundreds of hours of Seconds from Disaster / Air Crash Investigation, trimming an aircraft is turning a dial that changes the airplanes "forward" direction. So maybe it changes the control surfaces so that the plane is flying straight forward even though the rudder for example is at some deflection angle that isn't 0.
However if I was asked to define trim I couldn't exactly say what it is, what situations I would use it for or how it's achieved.

A:

If the aircraft is trimmed, the flight controls are in a state where no force needs to be exerted in order to continue straight and level flight. Aerodynamic and gravitational moments about all three axes are nulled out.
Changing the trim of the aircraft in pitch could happen in the following ways:

a shift in centre of gravity, for instance by shifting fuel from centre tanks to tail tanks, or payload shifting position;
a change in thrust of an engine that is located above or below the centre of gravity;
a change in horizontal tail angle or trim tab;
a deflection of the elevator.

If the aircraft was in straight and level flight and the trim changes because of a change in any of the above, it can be compensated for by the other factors. Elevator deflection is fastest but requires a pilot force which is uncomfortable for longer periods, that is why the forces can be trimmed out to make the new stick position the neutral force one.

A:

Trim is the control that adjusts the trim tab. 
Effectively its a way to fine tune/change the control surface to elevate control forces. Since airplanes can be loaded differently and the Center Of Gravity moves as the aircraft burns fuel the control surfaces must be slightly adjusted for each flight/flight segment to achieve straight and level flight for a given configuration/load. 
Wiki gives a nice description of it, this is for elevator control but the same applies for all control surface trim.  

Elevator trim frees the pilot from exerting constant pressure on the
  pitch controls. Instead, the pilot adjusts a longitudinal trim control
  (often in the form of a wheel) to cancel out control forces for a
  given airspeed / weight distribution. Typically, when this trim
  control (wheel or lever) is rotated or moved forward, the nose is held
  down; conversely, if the trim control is moved back, the tail becomes
  "heavy". Many newer aircraft, especially jet aircraft, have electric
  trim controls.

There is a nice article on it here as well as here

what situations I would use it for or how it's achieved.

The trim is generally adjusted any time the aircraft transitions flight phase (climb to cruise, cruise to decent etc) or when the power setting is changed or periodically in cruise if the CG is greatly effected. For example if you climb out at full power, reach your cruising altitude of 3000 ft. push the nose over and pull the power back to your cruise power setting you may find you are still applying forward control pressure to keep the airplane from climbing. In this case you would trim off the control pressure by rolling the wheel forward until you no longer needed to apply control pressure to keep the plane level. At this point you could fly "hands off". 

