This literally means 'to complete, finish' but can (and usually does) involve a regret over having done something. Also it can be used sarcastically to mean the speaker really wanted to do something, but gives a halfhearted apology. For example, 最後のクーキーを食べてしまった。 I unfortunately ate the last cookie. Of course there really wasn't anything unfortunate about it.
The construction is usually after the ~te form of any verb
zenbu no okane o tsukatte shimaimashita.
Unfortunately, I spent all my money.
watashi wa kanzen ni nihongo o wasurete shimatta.
Unfortunately, I have completely forgotten Japanese.
Another very useful variation is ~chatta. This is informal and is used by both male and female speakers. chau is made by combining te shimau -> chau
shiken ni ochichatta.
I flunked the test unfortunately.
or in the present tense