Bavaria generally doesn't look like the best country to play: Trapped in the German Confederation, there is no real room to expand, no sea access, and a small military. However, you're right in the middle of the action and industrialized. All information below is for "Revolutions".
Building up is typical, and the two capitalists will help build factories/railroads with generous taxation. I'd recommend 49-49-32 taxes, with moderate tariffs: Kick the education and defense to the max. Switching to Constitutional Monarchy and allowing for liberalizing reforms won't bring about any counterrevolutions that the other German powers bring, and an alteration between the Conservatives and Liberals will allow for more growth.
Declaring war and occupying Holstein before 1847, and marching a large army immediately to Copenhagen to get the Danes to cough up provinces, can gain some population. Remember, your culture is South German only, so North German POPs aren't very effective or worth occupying.
You have two options to make things more interesting. Otherwise, simply refuse becoming part of Germany when the time comes.
Take on the Deutscher Bund
Declaring war against any other member of the German Confederation will bring about an all out war with everyone around you, meaning action will have to be quick and your army mobilized at a go. This is probably best done before 1855, and you'll have to have around 40 divisions or more for success.
All moves should be done at once:
- Since you've caught Austria by surprise, you can take a 5-10 division army, occupy a few territories on the way to Vienna, and just stay there and ask for a quick, white peace.
- Use a couple units each to occupy Baden and Wurttemburg's capitals and ask for one province from each for the peace deal. You can't annex now, but maybe in a bit.
- Occupy Hesse/Nasseau/Frankfurt and Saxe countries, defeat their armies and annex ASAP. Groups of 3 troops each are a good plan.
- Use a 5-10 army to annex Saxony quickly (Factories mean it's worth taking despite being mostly Northern Germans).
Now, if you've done all this successfully, you've grown quite a bit, but Prussia has probably mobilized and is ready to try and crush you. This is the hardest part, but if you can move your armies back and hold on (Maybe give up Saxon provinces if necessary), you have a much bigger Bavaria. Annex Baden and Wuerttemberg a bit later.
Wait for 1866
After the Austrian-Prussian War breaks out, you'll probably have to take Austria's side. The only priority should be to try and occupy as much Prussian soil as you can so you can escape relatively unscathed while keeping Prussia from annexing South German territories, or just take the prestige hit and ditch the alliance.
After Austria gets mopped up, they'll offer you a choice of heading a new Zollverein. Take it, and you'll be transformed into the bright-yellow "South German Federation (SGF)," get a familiar flag, and automatically annex Baden, Wuerttemberg, and any of the Saxe countries. Once you clean up the 80k soldier pops and such, you'll have a power on your hands with a good amount of prestige. Sweet, eh?
Problems, however. You're an Austrian satellite. This can be fixed by arranging a war with (Now pretty much ally free) Austria and taking a province while winning, which shouldn't be so tough. Lean towards taking an entire state: Salzberg/Zell-Am-Zee is safe, but unindustrialized; Bohemia-Moravia a bit tough to hold on to (with minority issues with the Czechs) but heavily populated and industrialized; and while Tirol (Bozen-Lienz-Innsbruck, etc) might look like a nice compromise, it will bring you into future disputes with Italy.
"For want of a Nail" and all that
A strong Bavaria/SGF really changes the game up:
- If France allied with Austria in 1867, Prussia probably lost some land there, and may have gotten the "Napoleonic Trimuph/Fall of Prussia" sequence that blocks German unification and makes the North German Federation a French satellite. This means there's three Germanies, all with cores on each others land. Tread carefully, especially considering that Italy is probably still allied with Prussia. Once you build up, however, and the inevitable war with France breaks out, try and get the Rhineland states, Alsace Lorraine, and Hesse with Prussian or Italian assistance.
- If Germany does form, they still have cores on your Federation. However, if Prussia still has Sigmaringen and takes it into Germany, they'll probably ask you for military access, this will keep them from invading.
Russia usually takes out Austria out piece by piece, so pick from that carcass if you can without Prussia, Italy, or France coming at you all at once. Getting sea access can bring colonization into the picture, but will require probably a pretty serious war/badboy with the NGF/Netherlands/Belgium (Or creative annexation of Austria).
The SGF/Greater Bavaria can make a major run up the ledger.