If you are detained in an Immigration Removal Centre you can ask for a 30 minute appointment with a solicitor from one of the legal aid firms visiting your removal centre. This is called the Detention Duty Advice Scheme. There will be a number of firms visiting on a rota basis, meaning that different lawyers visit each week. The current rotas can be download below.
During this short initial meeting the solicitor will assess your immigration case and work out whether they can offer you free legal advice based on the merits of your case (how strong it is or how likely you are to succeed) and your financial means. You will not have to pay for this meeting, and will not have to pay for the advice they give you if they decide to take on your case. You should however be aware that there is no longer legal aid funding for certain aspects of your immigration case (for example a deportation appeal) even if your case is a strong one.
Ask at the library for an appointment, or ask a welfare officer.