Map from Google - Bosnia_Herzegovina

In Bosnia and Herzegovina, the climate is Mediterranean in the small stretch of plain near the sea (see Mostar), while it gets colder and more continental in the hilly and mountainous west-central area, mainly because of altitude (see Sarajevo), and becomes continental, with cold winters and hot summers, in the northern plains (see Bihac, Tuzla).
Cold waves from the north and north-east, typical of the Balkan Peninsula in the winter months, bring snow and frost in most of Bosnia, while they only bring wind and a bit of cold in the plain of Mostar.
Precipitation is abundant in most of the country, except in some sheltered valleys and in the northernmost area, near the border with Croatia.

The country has a very short coastal stretch, about 7 kilometres (4 miles) long, for the rest the border is just a few kilometres from the sea, while the coast belongs to Croatia. The maritime area has a Mediterranean climate, mild but rainy in all seasons except summer. Behind this stretch of coastline, there's a plain where the city of Mostar is located, but also the pilgrimage site of Medjugorje, which has a transitional Mediterranean climate, with winters a bit cold (in Mostar the average in January is 5 °C or 41 °F) and hot summers (the average in July is 25 °C or 77 °F). In summer, due to the location a bit isolated from the sea, hot days are possible, with peaks of 40 °C (104 °F).
Here are the average temperatures of Mostar.
Average temperatures - Mostar
MostarJanFebMarAprMayJunJulAugSepOctNovDec
MostarJFMAMJJASOND
Min (°C)235813161918151173
Max (°C)81115192428313127211510
Min (°F)363741465561666459524537
Max (°F)465259667582888881705950

This is also a rainy area, where almost 1,500 millimetres (60 inches) per year fall, and the only relatively dry months are July and August, with respectively 40 and 50 mm (1.5/2 in) of rain. Here is the average precipitation.
Average precipitation - Mostar
MostarJanFebMarAprMayJunJulAugSepOctNovDecYear
MostarJFMAMJJASONDY
Prec. (mm)1351301151101057040501001702002251450
Prec.(in)5.35.14.54.34.12.81.623.96.77.98.957.1
Days1098997436101214101

If you exclude this small region near the sea, the rest of Western Bosnia consists of hilly and mountainous areas, being crossed by the Dinaric Alps, so the climate is colder. Let's start with the cities located at low-mountain altitudes.
In Livno, about 50 km (30 mi) away from the sea and 700 metres (2,300 feet) above sea level, the average temperature in January and February is 0 °C (32 °F), that of July is 18 °C (64 °F).
In Sarajevo, the capital, 120 kilometres (75 miles) away from the sea and 650 metres (2,100 ft) above sea level, the average is -0.5 °C (31 °F) in January, and 19.5 °C (67 °F) in July and August, when highs are around 26 °C (79 °F) and lows around 13 °C (55 °F), so nights are pretty cool. In winter, during cold waves the temperature can drop to -20 °C and even lower, while in summer sometimes it can get hot, with peaks of 35/37 °C (95/99 °F), although usually it cools off at night. Here are the average temperatures.
Average temperatures - Sarajevo
SarajevoJanFebMarAprMayJunJulAugSepOctNovDec
SarajevoJFMAMJJASOND
Min (°C)-4-21491113131062-3
Max (°C)361015202326262217104
Min (°F)252834394852555550433627
Max (°F)374350596873797972635039

In Sarajevo, precipitation is less abundant than in the coastal area, and amounts to about 900 mm (35.5 in) per year, but it's well distributed throughout the year, because the rains brought by western frontal systems in the cold half of the year, are replaced by some afternoon thunderstorms in late spring and summer. In winter, there is no shortage of snowfall.
Here is the average precipitation.
Average precipitation - Sarajevo
SarajevoJanFebMarAprMayJunJulAugSepOctNovDecYear
SarajevoJFMAMJJASONDY
Prec. (mm)6565606590907070801059085935
Prec.(in)2.62.62.42.63.53.52.82.83.14.13.53.336.8
Days11101010121196791111117

Throughout this area of hills and low mountains, the wind is quite frequent. In Sarajevo, the south-west wind, which blows more frequently in spring, is similar to the Foehn, that is, a warm and dry wind descending from the mountains.

Sarajevo

In high mountains the climate gets naturally colder. For example, in the mountains south of Sarajevo, at 2,000 metres (6,500 feet) above sea level, the average temperature in January is -6 °C (21 °F), while in July it's 10 °C (50 °F).

In the northern plains, in cities like Bihac, Tuzla, Banja Luka, the climate is continental, with an average around freezing (0 °C or 32 °F) in January, and around 20 °C (68 °F) in July.
Here are the average temperatures in Banja Luka.
Average temperatures - Banja Luka
Banja LukaJanFebMarAprMayJunJulAugSepOctNovDec
Banja LukaJFMAMJJASOND
Min (°C)-5-21591214131062-3
Max (°C)471217222527272317115
Min (°F)232834414854575550433627
Max (°F)394554637277818173635241

Here, too, precipitation amounts to around 900/1,000 mm (35/40 in) per year, so it's still quite high, and also well distributed, because even here there are frequent thunderstorms in summer.
Here is the average precipitation in Banja Luka.
Average precipitation - Banja Luka
Banja LukaJanFebMarAprMayJunJulAugSepOctNovDecYear
Banja LukaJFMAMJJASONDY
Prec. (mm)707075901001207565701051051151060
Prec.(in)2.82.833.53.94.732.62.84.14.14.541.7
Days11111010101195681312116

The Adriatic sea is warmest in July and August, when the temperature is 24/25 °C (75/77 °F), while it's still acceptable in September, when the temperature is 23 °C (73 °F), and a bit cool in June, when it's 21 °C (70 °F).
Sea temperature - Neum
NeumJanFebMarAprMayJunJulAugSepOctNovDec
NeumJFMAMJJASOND
Sea (°C)141414151821242523201715
Sea (°F)575757596470757773686359

When to go

The best time to visit most of Bosnia and Herzegovina, namely the towns in the hilly area and in the interior northern plain, goes from June to September. Given that in July and August some hot days are possible, you may prefer June and September if you don't like the heat. The summer weather is often sunny, but there can be thunderstorms in the afternoon. Normally, nights are cool.
The short coastal stretch having a Mediterranean climate, is good for beach life in summer.
In the lower valley of the Neretva River, in Mostar or Medjugorje, where the climate is almost Mediterranean, you can choose May, June and September. In July and August the rains are rare, but sometimes it can be hot. From October to April, therefore even in winter, the weather is usually mild, but sometimes it's windy, and in addition the rains are abundant.

What to pack

In winter: for Sarajevo and inland areas: warm clothes, sweater, down jacket, hat, gloves, raincoat or umbrella. For the plain of Mostar and the coast: warm clothes, sweater, coat, raincoat or umbrella.
In summer: light clothes, T-shirts, but also long pants, light jacket and a sweatshirt for the evening and for cooler days, especially in inland areas; umbrella.