I've heard that some slaves were seen as able to perform complex tasks instead of menial labour and even had a chance to participate in government.
Would it help if I converted to Islam?
Do I have any chance of being freed without having my ransom paid?
Do you have an tips on what I should do to better my situation?
Let's say the year is 1750
Things were really calming down by the early 18th century for the Barbary Corsairs. With the growth of European political and naval power, the Corsair states of the North Africa were taking efforts to ostensibly hinder privateering activity, due to pressure from France, England and Italian principalities. However, prisoner ransoming and slaving took place well into the 19th century. If you are well-educated then you must be wealthy, so maybe you could have met their ransom requirements, but probably not due to the corsair's pension for unfair business tactics, such as changing the price after both parties agreed. So come to terms with being a prisoner in North African pirate society.
North African society is not monolithic so it depends where you were taken. Hopefully you were taken to Algiers or Tunis, but if were taken to Alexandria or Cairo your chances of future success are significantly smaller.
That being said, prisoner conditions were poor, but the Corsairs, it is reported, were not overly cruel or savage. They engaged with prisoners, learned what they had to offer and taught them what they needed to know to survive in pirate society.
There were two types of prisoners, those determined to be assets to the corsairs, and those who were not. The latter were often immediately sold as laborers to famers, craftsmen, or to Princes. The former, would be kept aboard to aid in corsair efforts. Seasoned sailors of the Mediterranean and naval soldiers of European navies were especially prized. Keep in mind, a sizable sum of corsairs were captured or impressed at some point in their career, so if you proved yourself as a reliable and knowledgable sailor they would use you to that extant.
However, if you are a land lubber and educated accordingly the Corsairs would sell or gift you to a prince. The princes, especially in the 18th century and into the 19th century, valued the advice and knowledge or Europeans. 1 or 2 centuries ago conditions for you might not have been so good, but in the age of growing international and trans-Mediterranean relations your advice and counseling if it proved useful would be rewarded.
For all their granted opportunities of success, the corsairs were still pirates and still did pirate things like castrating people who attempted to escape, sticking your head into a loaded cannon then firing it, or hanging you on the docks of the port. Sailors have no use for extra weight and will always act accordingly to deal with unwanted personnel; this is universal to all privateers and pirates.
You would never be fully trusted and allowed into North African society though. You are a slave and even if you worked for the Prince, Vizier, or Beylerbey your contact with the higher ups would be limited.
Finally to address the question of converting to Islam, the answer is yes, you would be freed in a sense if you converted to Islam. However it is a catch-22. If you convert to Islam you are free to serve the Islamic regency as you wish and become a business man, but if you betray by attempts of returning to Europe you will be branded a traitor or apostate and be killed not by the religious authority or under Islamic law but under the political law of the land. But if you do not convert, you will always be a prisoner in a sense, supervised and restricted in your actions. But like I said, even as a prisoner there were avenues for economic and professional advancement.