How do you get Portugal/Brazil to German or even close levels considering the extremely poor levels of literacy there, the backwardness, and then the horrible infrastructure in Brazil itself? It had the same issues as Spain.
Brazil theoretically can get to industrialize much faster and better than it did historically if its constituent regions were linked up earlier than they were historically in order to magnify economic growth. Before the 1880s, Brazil might as well been 3 countries, economically speaking. You had the south being their major industrial sector (granted limited in scope given the low population and relatively low railroad milage compared to the US or Argentina), the north being nothing but major plantations and mines, and the vast hinterland of the state dominated primarily be subsistence agriculture and artisanal production which doesn't bring in any money at all. These places weren't really dependent on each other for much and the lack of connection really hurt the potential of Brazil's ISI style industrial policy during the period.
If you were to link the country up much earlier, than you can get the south more of the workers it needs and a bigger market (as better transportation will lower the cost of goods thus making the Brazilian domestic market more competitive) and in turn, improve the north as the wages earned by northerners will go to their families up north and west, who will in turn invest in their homes. Greater production and wealth will mean higher wages after a while, which improves rates of immigration, that cause the feedback loop of industrialization. Basically, what happened between the 1930s-50s, but instead in the ~1850s-1900s.
How do you kick off the rush for more railroads, better roads and better ports?
That I have no idea. Nor do I know if that could lead it to being Germany tier, but can certainly get it better than today as industrial development were to be in a better place.
Depends how well it modernises. Probably can be at least Italy tier, even if large parts of the region will suffer from backwardness for a long time. Still better than either OTL Persia or their rivals the Ottoman Empire for that matter.
Persia in the 1700s is in a good spot for better developing due to the rise of the Afsharids forming a modern army in Iran, and Nader Shah's military genius allowing him to win over much needed territories. If he doesn't go insane, doesn't murder his son and continues his string of victories (this is doable given he started to lose it after some disease gotten apparently by a mosquito bite; just need to butterfly away his disease) than Iran is in a much better, much more stable position, critically with regards to its tax base and economy.
Mainly this is due to a much larger population, and because of a dynasty that isn't formed by and beholden to nomadic tribal interests. In around 1700 the Safavid realm had 7 million people, more or less. Taking Iraq from the Ottomans brings with it another million, as does taking the Central Asian states. The parts of Afghanistan and Baluchistan not under Safavid control (east of Herat more or less) give another 2-3 million, which grants you a state that with around 11-12 million people by his death. Almost a 50% increase. Additionally, the lack of control by a nomadic dynasty means the state no longer has to care about its nomadic population as much and won't give off vast tracks of perfectly good agricultural land to as pasture for tribes. Nor will nomads be needed by the army; Iran's got a mass gunpowder army to enforce its will. Instead, a greater emphasis in settlement and investment in agriculture will follow.
The impact of this means that Persia will enter a population boom as agricultural production goes through the roof, particularly in Mesopotamia where Iraq once more returns to former glory (thanks to not being an Ottoman frontier march and instead a key strategic region). Settlement and stability will create an economic boom, and that in turn improves urbanization and of course, increase population. Probably not 20 million by 1800, but pretty close. A vast labor force and a realm that includes the needed coal and mineral reserves to start industrialization in the coming decades.
Alternatively, you can somehow get the Safavids to bounce back. But the Afsharid route is easier I think.