My TL;DR Definition

An object's state is broadcast to it's subscribers if a change occurs

Slightly Longer Definition

There is a relationship between two kinds of objects: a subject and an observer. There is only one subject object and it will update the observers when a change occurs to its internal state. The observers are subscribed to the subject and concerned with the subject's state for any number of reasons. The observers can freely leave or join the relationship.

Earthquake Notifier Example:

Suppose there is a town that frequently has earthquakes. The citizens can get hurt if they are not safe place when an earthquake occurs. The town has installed some monitoring instruments and a seismograph lab. The scientists have a system that can predict when an earthquake is going to occur an hour in advance.

(This is just an example, I don't know if this is actually possible?)

The last thing that is needed is a system that can broadcast the warning to the townspeople via their smart device. This way, they can plan accordingly and head to safety.

Pseudocode:

public interface Subject
{
	public void addObserver(Observer observer);
	public void removeObserver(Observer observer);
	public void notify();
}

public interface Observer
{
	public void update(bool earthquakeStatus);
}

public class EarthquakeLab implements Subject
{
	private ArrayList observers;
	private bool earthquakeStatus;

	public EarthquakeLab()
	{
		observers = new ArrayList();
	}

	public void addObserver(Observer observer)
	{
		observers.add(observer);
	}

	public void removeObserver(Observer observer)
	{
		observers.remove(observer);
	}

	public void notify()
	{
		foreach(ob in observers)
		{
			ob.update(earthquakeStatus)
		}
	}

	public void measurementChanged()
	{
		notify()
	}

	public void getEarthquakeStatus(bool earthquakeStatus)
	{
		this.earthquakeStatus = earthquakeStatus;
	}
}

public class PhoneDisplay implements Observer
{
	private bool earthquakeStatus;
	private Subject earthquakeLab;

	public PhoneDisplay(Subject earthquakeLab)
	{
		this.earthquakeLab = earthquakeLab;
		earthquakeLab.addObserver(this);
	}

	public void update(bool earthquakeStatus)
	{
		this.earthquakeStatus = earthquakeStatus;
		display();
	}

	public void display()
	{
		//notification shows up on phone screen
	}
}