I want to travel to Ibiza again this summer. I want to go there from Tehran, Iran via connecting flights. For example, I would like to fly from Tehran to Frankfurt on Lufthansa, and then from Frankfurt to Ibiza on Ryan Air. What websites can I use to do this?
As stated in Hilmar's answer there needs to be some arrangement (code share) between both airlines to book it as a single ticket.
When those arrangements don't exist, one option is still to make this booking as two separate tickets on your own in which case you bear the risk of missing your connection.
A third option is to book a connecting flight through Kiwi.com, a site which specializes in selling unofficial connections between airlines who don't have agreements with each other. In this case Kiwi.com includes insurance under the name of the "Kiwi.com Guarantee." In case you miss the connecting flight, you contact them and they have staff that will rebook you onto the next best option.
For any unofficial connection (making your own two bookings or via Kiwi.com) also note that there may be additional visa requirements for the airport you're transferring at. If you have checked luggage you may have to leave the secure area of the airport and pick it up at baggage claim and recheck it when switching airlines. Some airlines do have interlining agreements where they can forward baggage between each other, so it's always worth asking them if. Even if you have just a carry-on you may also have to leave the secure area to access check-in for the connecting flight if you're not able to do it online or at a transfer desk.
You have to make two individual bookings, you can't book this on a single ticket.
You can make each booking at any of the typical websites: Lufthansa.com ryanair.com, kayak.com, expedia.com, orbitz.com, hipmunk.com, google flights etc.
Please note that you are responsible for any missed connections: if your flight from Teheran is late and you miss the flight with Ryan Air, you may have to buy a new ticket or get stuck in Frankfurt. Make sure you have plenty of time.
Please note also that Ryan Air often uses Frankfurt Hahn Airport. That's a marketing ploy: Frankfurt Hahn is about two hours away from Frankfurt and closer to Luxemburg than to Frankfurt. Make sure you book Frankfurt International Airport (FRA) and not Frankfurt Hahn (HHN).
There is a difference between true "connecting flights", which are arranged as one booking, and buying several different tickets and pretending that they are connected flights.
The exact itinerary you gave is not bookable as connecting flights. (See Hilmar's answer for details.) This is because RyanAir does not cooperate with any other carriers. You have to buy the tickets separately.
For true connecting flights, even between different carriers, it is straightforward to book either through one of the airlines directly or through a travel agent. I had a look and you can buy a seven day return ticket from IKA to IBZ for 500 USD leaving next week on British Airways and Iberia as a single ticket. This can be booked on Expedia.com or any major internet travel site.