Q:

What does a lawyer do if they know for absolute certain that their client is guilty?

Say that a person is accused of committing a crime, they either hire a lawyer or have one appointed to them. Some time later, the lawyer learns that their client most certainly committed the crime. Perhaps the client shows the lawyer a video of them committing the crime (and it is proven to be genuine).
What does a lawyer do in this case? Are they required to continue to defend their client (and would that mean they may be forced to commit perjury?) or are they allowed to choose not to continue to represent their client in the interest of finding the truth and upholding justice?
If there are any historical cases where this sort of thing happened, mentioning them would be a plus.
For the sake of argument, let's assume that the lawyer is somehow able to know with 100% certainty that their client committed the crime, so there is no issue of the lawyer passing judgement when there is a chance of doubt.

A:

There is a big difference between knowing something and proving it. A lawyer who knows a client is guilty can take steps to prevent the state from proving guilt. (E.g., motion to exclude evidence, cross examining witnesses.)
The belief that a client has committed a crime does not necessarily mean one knows what specific crime was committed. Is a killing Murder 1, Murder 2, or manslaughter?
There are defenses even when an act may be a crime. E.g., self defense, insanity, justifiable.

Lawyers are not permitted to assist in perjury. E.g., allow the client to testify to something he knows is false.

A:

If there are any historical cases where this sort of thing happened,
  mentioning them would be a plus.

There are answers that address some other points, but there is something that should be made clear.
Cases where the criminal defense lawyer knows that their client is guilty of a crime are not the exception, they are the norm. 
Cases where the client is definitely or probably innocent of all crimes are the rare exception, and are actually much more difficult and stressful because in those cases the only really acceptable option is a full acquittal which may be difficult or impossible to achieve.
Approximately 95% of people charged with crimes will plea guilty or be found guilty at trial.
A criminal defense lawyer's main jobs are: 
(1) to hold prosecutors to their obligations to prove their case beyond a reasonable doubt with legally gathered and admissible evidence (a function that protects the public generally from law enforcement misconduct by discouraging it), 
(2) to make sure that the offense of conviction is no more severe than necessary because often someone is charged with a more serious crime when the facts are better described by a less serious crime or one with different collateral consequences, and 
(3) to obtain an appropriately lenient sentence for their client.
None of these jobs makes it necessary for the client to be innocent, and no one who practices criminal law with any regularity has any ethical concerns about representing someone who is absolutely certain to be factually guilty.
The criminal defense lawyer's primary ethical obligation with respect to a factually guilty defendant is not to offer testimony that the criminal defense lawyer knows to be false in an evidentiary hearing or at a trial. But, the client never has to testify at all and neither does the lawyer. A not guilty plea is not a statement made under oath and cannot be perjury. It is perfectly legal to make a not guilty plea even if you know for certain that you are factually guilty of a crime.

