Unemployment insurance is part of the state-regulated social security system. It provides insurance to those who become unemployed. To be entitled to receive unemployment insurance payments, you must have worked in Germany directly before becoming unemployed, you must have been employed and contributing to social security for at least 12 months in the last 2 years and you must be available to take on new employment. Previous employment in the EU or EEA countries and Switzerland can possibly be recognised.
Unemployment insurance is deducted automatically and directly from your gross income. Generally, the employer and the employee each pay half of the premiums.
You will need to inquire in your home country whether your payments in Germany can be taken into account in the unemployment insurance system of your home country. If you return to a country that does not have a social security treaty with Germany, it is not possible to receive German unemployment insurance payments there. The payments can also not be reimbursed.
The provider of unemployment insurance is the Federal Ministry of Employment with its local employment agencies (Agenturen für Arbeit).
There is more information available on the web site of the German Social Insurance (Deutsche Sozialversicherung).