The current mirror is very popular in IC design. But what does it do? As the name implies, it simply tries to provide a stable current source by "mirroring" the current of a reference branch. (Remember that current sources when loaded still provide the same amount of current, the voltage varying consequently). The current mirror is constructed by shorting a collector and 2 bases of 2 BJTs and a drain and 2 gates of 2 MOS.

Below is a futile attempt in simulation [back when I was still a college amateur].

In order to understand how the transistors provide equal constant currents, let us take the example below.

Above are 2 2N2222 NPN transistors functioning as a current mirror. Q2 has its collector shorted with the base. The 2 resistors are ohmic, so we can assume Ohm's law to be valid over that branch. The current supplied is 5 mA and 6.667 mA(initially) to Q2 and Q1 respectively. The bipolar junction transistor is a current controlled device. Thus, if the collector of Q2 is controlling the amount of output at the emitter of both transistors, and since both have approximately the same beta, hfe, or operating characteristics, the Ie flowing out of Q2's emitter approaches the Ie flowing out of Q1's emitter. Voltmeter XMM1 detects a current of 4.615 mA at Q2's emitter. (The ideal maximum forward beta of 2N2222 is 153.575)

10=(2k)It+0.7

It=4.65 mA initially

Q1 and Q2 start conducting. (Vce=0.2 V)

Now that It=4.65 mA(KCL), It=(beta)Ib+2*Ib (remember 2 bases), Ib=0.029889121 mA.

Ic=4.59 mA

Ie=Ic+Ib= 4.62 mA

Now for Q1:

Since Q1 and Q2 are shorted, both power supplies are electrically connected, thus:

10=(2k+1.5k)*(It/2)

It=5.714 mA=Ic

Ib=0.029889121

Ie=5.745 mA

(Both values are a little off tangent to the simulation, and the theory I applied above have assumptions. Anyhow, current mirrors provide two equal current sources in spite of the 500 ohm difference between the 2 resistors. If you have any comments, please feel free to leave them below.)

For educational purposes, here are cases where the resistors of the current mirror have varying resistances:

Unfortunately, the simulations above are quite spurious, since the circuit implementations are awry.

Simply put, current mirrors can mirror current because the terminals that control the current through the emitter-collector or source-drain terminals (i.e. the base and gate) are common to each other. (A simulation isn't really necessary)
Also, there may be minute differences in the mirrored current due to the 2 bases/gates drawing current from the collector/drain.