This is a varied and complex subject. As a good thorough example of a crevasse rescue done well check out This video.
Even with this thorough example, there are things that could be improved or argued that x should be done differently. As with many mountaineering techniques, practice and experience are the key.
As a summary, typically there are 3 steps to a crevasse rescue attempt.
The first stage is secure the person in the crevasse
Typically in this scenario, all members of the party will be lying down holding the falling person using self-arrest technique (ice axe pushed into the snow, etc.). To start the self rescue one person needs to be removed from this brace position. This needs to be done carefully, ensuring that the other member of the party are not pulled into the crevasse themselves.
One of the party needs to slowly release themselves from the tension in the rope and stand up. This needs to be done carefully, ensuring that the other members of the party remain secure.
Once a person is released they must build a good snow anchor. You need to weigh up time vs security here. A dead man is very secure but can take time to build, whereas an ice axe plunged deep into solid snow is less secure but is faster. The technique will depend on the circumstances so a degree of experience in building such anchors is essential.
Once the anchor is built, the person in the crevasse is secured to this anchor. This is done be attaching a prusik to the rope and securing onto the anchor.
Now that the person is secure all other members of the party should be able to join the rescue. One person must remain to ensure the anchor/potentially take the weight should the anchor unexpectedly fail.
Build a Z pulley
Now the person is reasonably secure, we need to add redundancy into the system and build a system to hoist the casualty out of the crevasse. This is where a Z pulley comes in.
The first stage is to build a second, "bomber" (very secure), anchor further back from the temporary one built above. You should be able to put a bit of time into this building a good solid dead man or snow bollard. Whatever you choose it needs be very secure, since this will take the majority of the strain when hoisting the person out.
The rope is then tied to this anchor. You should now have at least two anchors (the initial, temporary one) one and the bomber one above. If anyone fails you now have a back up.
Hoisting a dead weight of a person and all their equipment vertically is very heavy. 2 people will struggle to lift a person on a dynamic rope. This is where the Z pulley comes in.
A Z pulley adds a ratio into the rope reducing the weight of the person being pulled out. To build a Z pulley you take the dead end of the rope attached to your snow anchor and re-attach it to the end of the rope connected to the person (again using a prusik).

source
Pull the person out
Now that the person in the crevasse is secure and you've built your Z pulley, you can begin hoisting them out. You'll want to keep the prusik on the line as a backup and to allow you to release the rope, but basically you now pull the end of the Z pulley (possibly using multiple people) until the victim is free.
There are several variations on this technique and this is designed as a rough guide but hopefully I've highlighted the main features.